The PromptGuard CLI scans your codebase locally to detect unprotected LLM SDK calls before you push to Git. It supports Python, JavaScript, and TypeScript projects.
Installation
macOS (Homebrew)
Linux / macOS (Binary)
Cargo (Rust)
Verify Installation
Quick Start
Scan Your Project
Initialize Protection
- Detects which LLM providers you use
- Installs the PromptGuard SDK
- Adds
promptguard.init()to your entry point - Shows you what changed
Commands
promptguard scan
Scan for unprotected LLM SDK calls.
Examples:
promptguard init
Initialize PromptGuard SDK in your project.
Examples:
promptguard check
Check if protection is properly configured.
promptguard fix
Auto-fix unprotected calls by adding SDK initialization.
Examples:
promptguard providers
List detected LLM providers in your codebase.
promptguard redteam
Run adversarial security tests against your configuration.
Examples:
promptguard policy
Manage guardrail configurations as YAML files (policy-as-code).
Examples:
Supported Providers
This table is generated from
sdk-patterns.json, the single source of truth the scanner reads. Mistral and Groq were previously listed here but have never been in it, and neither SDK patches them — the rows advertised detection that did not exist. Azure OpenAI is detected through the OpenAI patterns (AzureOpenAI is one of the recognised class names).Configuration
.promptguardrc
Create a config file in your project root:
Environment Variables
CI/CD Integration
GitHub Actions
Security Gate Action
Use the official PromptGuard Security Gate for automated red team testing on PRs:GitLab CI
Pre-commit Hook
Output Formats
Pretty (Default)
Human-readable colored output for terminal use.JSON
SARIF
GitHub Code Scanning compatible format:Troubleshooting
Command not found after installation
Command not found after installation
Solution: Add to PATH
No LLM calls detected
No LLM calls detected
Check:
- Are you in the right directory?
- Are the files in the include patterns?
- Try:
promptguard scan --include "**/*.py"
False positives in comments/strings
False positives in comments/strings
The CLI uses AST parsing, not regex. If you see false positives:
- Report at github.com/promptguard/cli/issues
- Use
--excludeto skip problematic files
MCP Server
The CLI includes a native MCP server for AI-powered editors:Next Steps
Cursor Plugin
AI-native security in Cursor
MCP Server
Connect to any AI editor
GitHub Scanner
Scan repos on push and PR
VS Code Extension
See findings in your editor