
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@codesherlock/codesherlock-cli
Advanced tools
AI-powered code analysis from your terminal.
CodeSherlock CLI lets you run security, quality, and compliance checks on your code without an IDE or MCP client. Use it in pre-commit hooks, and autonomous AI-native coding workflows.
npm install -g @codesherlock/codesherlock-cli
Verify:
codesherlock --version
# 1. Save your API key once
codesherlock auth <your-api-key>
# 2. Analyze the last commit
codesherlock analyze
# 3. Analyze uncommitted changes before committing
codesherlock analyze --uncommitted
Get your API key from https://codesherlock.ai/codesherlock-mcp-server/mcp/api/key.
Save it once — all subsequent analyze runs pick it up automatically:
codesherlock auth <your-api-key>
To use a different key for a single run without overwriting your saved key:
codesherlock analyze --api-key <your-api-key>
Your API key is stored in your OS keychain and never written to disk in plaintext.
codesherlock analyze
codesherlock analyze --uncommitted
codesherlock analyze --directory /path/to/your/repo
codesherlock analyze --factor owasp
| Factor | What it checks |
|---|---|
power_analysis | Security, quality, and compliance combined (default) |
owasp | OWASP Top 10 vulnerabilities |
cwe_mitre | CWE/MITRE weakness catalog |
cwe_kev | CISA Known Exploited Vulnerabilities |
codesherlock analyze --output json
codesherlock analyze [options]
--uncommitted Analyze staged/unstaged changes instead of last commit
--directory <path> Path to the Git repository (default: current directory)
--factor <name> Analysis focus: power_analysis | owasp | cwe_mitre | cwe_kev
(default: power_analysis)
--api-key <key> API key for this run (overrides saved key)
--output <format> Output format: markdown | json (default: markdown)
-h, --help Display help
-V, --version Display version
============================================================
CodeSherlock Analysis Results
============================================================
File: src/auth/login.ts
------------------------------------------------------------
Security
Security-related vulnerabilities and risks.
HIGH Hardcoded credentials found
Lines: 12-14
Problem:
| const DB_PASSWORD = "supersecret123";
Solution: Use environment variables instead.
Fix:
| const DB_PASSWORD = process.env.DB_PASSWORD;
============================================================
1 issue found.
============================================================
| Label | Meaning |
|---|---|
CRITICAL | Must fix immediately — actively exploitable |
HIGH | Fix before merging — serious risk |
MEDIUM | Fix soon — moderate risk |
LOW | Best-practice improvement |
[
{
"file_name": "src/auth/login.ts",
"language": "ts",
"analysis": [
{
"characteristic": "Security",
"description_of_characteristic": "Security-related vulnerabilities and risks.",
"issue_items": [
{
"severity": "HIGH",
"issue": "Hardcoded credentials found",
"solution": "Use environment variables instead.",
"start_line": 12,
"end_line": 14,
"issue_code_snippet": "const DB_PASSWORD = \"supersecret123\";",
"solution_code_snippet": "const DB_PASSWORD = process.env.DB_PASSWORD;"
}
]
}
]
}
]
# Authenticate once
codesherlock auth cs_mcp_abc123
# Quick scan of last commit
codesherlock analyze
# Scan uncommitted work before committing
codesherlock analyze --uncommitted
# OWASP-focused scan of a specific repository
codesherlock analyze --directory ~/projects/my-app --factor owasp
# Pipe JSON results into jq
codesherlock analyze --output json | jq '.[].analysis[].issue_items[].severity'
No API key found
Run codesherlock auth <your-api-key> first, or pass --api-key <key> on the command.
Unable to securely save API key in the OS keychain
Your machine denied keychain access. Enable keychain permissions and re-run codesherlock auth.
Network error: fetch failed
Check your internet connection. Requests are not retried automatically.
No file changes found
Ensure you have at least one committed change, or use --uncommitted for staged/unstaged files.
Too many files
Analysis supports up to 20 changed files per run. Split large commits or use --uncommitted to target a subset.
Demo video : https://youtu.be/c55BcFvonl4?si=6Df8oNaL9wQeVn5w
Full documentation: https://docs.codesherlock.ai/codesherlock-cli/cli/setup/guide
MIT
FAQs
CodeSherlock CLI — AI-powered code analysis from the terminal
The npm package @codesherlock/codesherlock-cli receives a total of 8 weekly downloads. As such, @codesherlock/codesherlock-cli popularity was classified as not popular.
We found that @codesherlock/codesherlock-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

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.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.