New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@opencodereview/cli

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencodereview/cli

Detect AI-hallucinated packages, phantom dependencies, and stale APIs in your codebase. Open-source CI/CD quality gate with local Ollama support — zero API cost.

latest
Source
npmnpm
Version
2.1.5
Version published
Maintainers
1
Created
Source

@opencodereview/cli

AI code quality scanner for the terminal — Detect hallucinated packages, phantom dependencies, stale APIs, and logic gaps in seconds. Open-source, runs locally, zero API cost.

npm version npm downloads GitHub License: BSL 1.1

✨ Why?

AI code assistants generate code fast — but they hallucinate packages, reference outdated APIs, and leave logic gaps. open-code-review catches these AI-specific defects before they ship.

🚀 Quick Start

# Run directly — no install needed
npx @opencodereview/cli scan .

# Or install globally
npm install -g @opencodereview/cli
ocr scan .

That's it. Scans your project and prints a quality report to the terminal.

📦 Installation

# Global install
npm install -g @opencodereview/cli

# Or use npx (no install)
npx @opencodereview/cli scan .

The CLI provides two binary names: open-code-review and ocr (shorthand).

📋 Commands

scan [path] — Scan for AI-generated defects (V4, default)

# Basic scan (L1, structural analysis)
ocr scan .

# Scan a specific directory
ocr scan ./src

# Higher accuracy with L2 (embedding + Ollama)
ocr scan . --sla L2

# Deep analysis with L3 (LLM)
ocr scan . --sla L3

# Diff-only mode (scan changed files vs main)
ocr scan . --diff

# Output as JSON
ocr scan . --format json --output report.json

# Output as SARIF (GitHub Code Scanning compatible)
ocr scan . --format sarif --output report.sarif

# Output as HTML report
ocr scan . --format html --output report.html

# Output as Markdown
ocr scan . --format markdown

# Chinese output
ocr scan . --locale zh

# Exclude test files
ocr scan . --exclude "**/test/**,**/*.test.*"

# Offline mode (skip registry checks)
ocr scan . --offline

# Skip scoring, just list issues
ocr scan . --no-score

scan-v3 [paths...] — Legacy V3 scan

ocr scan-v3 ./src --threshold 80 --format json
ocr scan-v3 ./src --heal    # Generate AI self-heal prompt

init — Create configuration file

ocr init    # Creates .ocrrc.yml in current directory

login — Set up license key

ocr login   # Opens registration page and prompts for key

config — View or update configuration

ocr config show                        # Show current config
ocr config set license AICV-XXXX-...   # Set license key
ocr config set cloud-url https://...   # Set cloud URL
ocr config set api-key your-key        # Set API key

⚙️ V4 Scan Options

OptionDescriptionDefault
--sla <level>SLA level: L1 (fast), L2 (standard), L3 (deep)L1
--locale <locale>Output language: en, zhen
--format <fmt>Output format: terminal, json, sarif, markdown, htmlterminal
--diffScan only changed files (vs origin/main)off
--base <ref>Base branch for difforigin/main
--head <ref>Head branch for diffHEAD
--config <path>Custom config file path.ocrrc.yml
--offlineSkip registry verificationoff
--include <patterns>File patterns to include (comma-separated)(auto-detect)
--exclude <patterns>File patterns to exclude (comma-separated)(none)
--ai-local-model <name>Ollama model for L2/L3(default)
--ai-local-url <url>Ollama base URLhttp://localhost:11434
--ai-remote-providerRemote AI provider: openai, anthropic
--ai-remote-model <name>Remote AI model name
--ai-remote-key <key>Remote AI API key
--no-scoreSkip scoring, just list issuesoff
--jsonShorthand for --format jsonoff
--output <path>Write report to file(stdout)
--license <key>License key

Environment Variables

VariableDescription
OCR_API_KEYRemote AI API key
OCR_SLADefault SLA level
OCR_LOCALEDefault locale
OCR_OLLAMA_URLOllama base URL
OCR_OLLAMA_MODELOllama model name

📊 Output Formats

Terminal (default)

  Open Code Review V4
  SLA: L1 | Locale: en

  Scanning...
  Found 3 issue(s) in 12 file(s)

  🔴 error    src/auth.ts:12     Package `@supabase/auth-helpers` not found in registry
  ⚠️ warning  src/date.ts:5      Deprecated API `moment().format()` used
  ℹ️ info     src/api.ts:23       Unused variable `tempResult`

  Score: 78/100 (C) — Threshold: 70 ✅ Passed

JSON

ocr scan . --format json
# Outputs structured JSON with version, issues, score, dimensions, and metadata

SARIF

ocr scan . --format sarif --output report.sarif
# Compatible with GitHub Code Scanning — upload as a check

HTML

ocr scan . --format html --output report.html
# Generates a visual HTML report with score breakdown and issue details

🔗 GitHub Action Integration

Open Code Review works great as a GitHub Action too. Use it in CI to automatically review every PR:

- name: Open Code Review
  uses: raye-deng/open-code-review@v1
  with:
    sla: L1
    threshold: 70
    github-token: ${{ secrets.GITHUB_TOKEN }}

Or use the CLI directly in your workflow:

- name: Scan with CLI
  run: npx @opencodereview/cli scan . --format json --output report.json

📋 Scan Levels

LevelWhat it doesSpeedAI Required
L1AST analysis: hallucinated packages, stale APIs, dead code, logic gaps⚡ ~5sNo
L2L1 + embedding recall for deeper pattern matching🚀 ~30sOptional (Ollama)
L3L2 + LLM deep analysis for nuanced code review🐢 ~2minYes (Ollama / Cloud)

🔒 Privacy

  • L1 & L2 (TF-IDF): 100% local — no external API calls
  • L2 (Ollama) / L3: Your code only goes to your own Ollama server or your chosen cloud API
  • We never see your code

📜 License

  • Personal & Open-source: Free under BSL 1.1
  • Commercial: License required — see codes.evallab.ai
  • Converts to Apache 2.0 on 2030-03-11

Keywords

ai

FAQs

Package last updated on 18 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts