Skip to main content

CLI tool to identify AI-generated code and bad coding patterns

Project description

🔍 Refine Vibe Code

A powerful CLI tool that analyzes your codebase for AI-generated code patterns, security vulnerabilities, and code quality issues. Perfect for developers who want to maintain professional code standards.

🚀 Installation

Global Installation

Install refine globally as a standalone tool:

pipx

pipx install refine-vibe-code

With uv

The fastest way to use refine is with uv. If you don't have it yet, install it with one command: curl -LsSf https://astral.sh/uv/install.sh | sh

uv tool install refine-vibe-code
uv tool update-shell

homebrew

brew tab CarlosMenke/homebrew-tab
brew install refine-vibe-code

Install from Source

Use this if you want to modify the code or contribute:

git clone https://github.com/CarlosMenke/refine-vibe-code.git
cd refine-vibe-code

# Setup and run instantly
uv run refine

Traditional Install (pip)

If you prefer standard Python tools:

git clone https://github.com/CarlosMenke/refine-vibe-code.git
cd refine-vibe-code
pip install .

Configuration Examples

Config generation

Global config, for all projects:

# Generate global config
refine init --global

# Location: ~/.config/refine/refine.toml
# Generate project config in current directory. Named refine.toml
refine init

# Use custom config file path
refine scan --config my_custom_config.toml

LLM Integration (for deeper analysis)

For the best results, configure an LLM provider:

If you want to use a free LLM, with high usage limits and good results, we recommend google gemini-2-flash model. Get API keys here: https://aistudio.google.com/api-keys

Model Recommendations

Choose the right model for your needs:

OpenAI Models:

  • gpt-4o - Latest GPT-4 optimized model, excellent for code analysis
  • gpt-4o-mini - Cost-effective GPT-4 model, fast and reliable
  • gpt-4-turbo - Previous generation, good balance of speed/cost
  • gpt-3.5-turbo - Fastest and cheapest, good for simple checks

Google Gemini Models:

  • gemini-2.0-flash-exp - Latest experimental model, most advanced
  • gemini-1.5-pro - Stable production model, good performance
  • gemini-1.5-flash - Fast and cost-effective model

Anthropic Claude Models:

  • claude-3-5-sonnet-20241022 - Latest Claude model, excellent for code analysis
  • claude-3-5-haiku-20241022 - Fast and cost-effective model

Google Gemini:

# In your ~/.config/refine/refine.toml
[llm]
provider = "google" # or openai, claude
model = "gemini-2.0-flash-exp"
api_key = "your-google-api-key"

OpenAI: Get your API key from: https://platform.openai.com/api-keys

# In your ~/.config/refine/refine.toml
[llm]
provider = "openai"
model = "gpt-4o"  # Recommended: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo
api_key = "sk-your-openai-api-key-here"

Anthropic Claude: Get your API key from: https://console.anthropic.com/

# In your ~/.config/refine/refine.toml
[llm]
provider = "claude"
model = "claude-3-5-sonnet-20241022"
api_key = "sk-ant-your-claude-api-key-here"

🚀 Usage Examples

Quick Start

# Scan current directory (default behavior)
refine scan

# Scan a specific directory or file
refine scan /path/to/your/project
refine scan specific_file.py

File Selection

# Include specific file types
refine scan --include "*.py" --include "*.js" --include "*.ts"

# Exclude common build/test directories
refine scan --exclude "node_modules/" --exclude "__pycache__/" --exclude ".git/"

# Scan only Python files, exclude test files
refine scan --include "*.py" --exclude "*test*.py" --exclude "*spec*.py"

# Scan specific directories only
refine scan src/ tests/ --include "*.py"

Output Formats

# Rich terminal output (default, with colors and formatting)
refine scan

# Plain text output (for scripts or logs)
refine scan --format plain

# JSON output (for integration with other tools)
refine scan --format json

# Verbose output (detailed information)
refine scan --verbose

Scanning Modes

# Fast classical analysis only (no LLM required)
refine scan --classical-only

# Deep analysis with LLM (requires API key)
refine scan --llm-only

Auto-Fix Mode

# Automatically fix simple issues (safe line deletions for removeing commets only)
refine scan --fix

CI/CD Integration

# Exit with error code on issues (for CI/CD)
refine scan --format json | jq '.has_issues'

# Generate reports for CI/CD
refine scan --format json > scan_results.json

# Strict mode - fail on any issues
refine scan --classical-only --exclude "*test*" || exit 1

Development Workflow

# Pre-commit hook - fast classical check
refine scan --classical-only --format plain

# Code review - detailed analysis
refine scan --verbose --debug --include "*.py"

# Security audit - focus on vulnerabilities
refine scan --classical-only --include "*.py" --include "*.js"

CI/CD Integration

GitHub Actions

Add this to your .github/workflows/ci.yml:

name: Code Quality Check

on: [push, pull_request]

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

      - name: Install uv
        run: curl -LsSf https://astral.sh/uv/install.sh | sh

      - name: Run Refine Vibe Code Check
        run: |
          # Fast classical check for CI
          ~/.local/bin/uvx refine-vibe-code scan --classical-only --format json --exclude "*test*" --exclude "*spec*" || exit 1

      - name: Upload scan results
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: refine-scan-results
          path: scan_results.json

Pre-commit Hook

Add to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/CarlosMenke/refine-vibe-code
    rev: v0.1.0  # Use the latest version
    hooks:
      - id: refine-scan
        name: Refine Vibe Code Check
        entry: uvx refine-vibe-code scan --classical-only --format plain
        language: system
        files: \.(py|js|ts)$
        exclude: ^(tests/|.*test\.|.*spec\.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

refine_vibe_code-0.1.2.tar.gz (177.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refine_vibe_code-0.1.2-py3-none-any.whl (92.8 kB view details)

Uploaded Python 3

File details

Details for the file refine_vibe_code-0.1.2.tar.gz.

File metadata

  • Download URL: refine_vibe_code-0.1.2.tar.gz
  • Upload date:
  • Size: 177.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for refine_vibe_code-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c177eab63f120393350c99c3e4c09bc12b9cb178de0ce49b4ea792683c551773
MD5 dad361ddaae111370031740d8185432f
BLAKE2b-256 e30bf3a829389b1ffbe40063911f98d9df1c9a3bc2fc5e9c9bc23f630e8bc1e2

See more details on using hashes here.

File details

Details for the file refine_vibe_code-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: refine_vibe_code-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 92.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for refine_vibe_code-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a09941a5a3d050ea9a0ae59d02a4b9eb62591ffe0e3a3a04691be6993bd996da
MD5 19c192d125d9e0ddf9fc418cb68be04f
BLAKE2b-256 8263ba4ab6621e01ef2512dc4e44465cd1ec7c462c42d0dca6bbb826b8dfed86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page