Documentation Index
Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
Use this file to discover all available pages before exploring further.
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.
| Option | Description |
|---|---|
--format <fmt> | Output format: pretty (default), json, sarif |
--severity <level> | Minimum severity: low, medium, high |
--include <glob> | Only scan matching files |
--exclude <glob> | Skip matching files |
--ci | CI mode: exit code 1 if issues found |
promptguard init
Initialize PromptGuard SDK in your project.
| Option | Description |
|---|---|
--api-key <key> | PromptGuard API key (or use env var) |
--mode <mode> | enforce (default) or monitor |
--dry-run | Show what would change without modifying files |
--provider <name> | Only configure specific provider |
promptguard check
Check if protection is properly configured.
promptguard fix
Auto-fix unprotected calls by adding SDK initialization.
| Option | Description |
|---|---|
--dry-run | Show diff without applying |
--file <path> | Fix specific file only |
promptguard providers
List detected LLM providers in your codebase.
promptguard redteam
Run adversarial security tests against your configuration.
| Option | Description |
|---|---|
--preset <name> | Policy preset to test (default: default) |
--test <name> | Run a specific test by name |
--prompt <text> | Test a custom adversarial prompt |
--autonomous | Run the LLM-powered autonomous agent |
--budget <n> | Iteration budget for autonomous mode (default: 100) |
--format <fmt> | Output format: human or json |
--verbose | Show detailed per-test results |
promptguard policy
Manage guardrail configurations as YAML files (policy-as-code).
| Action | Description |
|---|---|
apply <file> | Apply a YAML policy file to the project |
diff <file> | Show differences between YAML and live config |
export | Export current live config as YAML to stdout |
| Option | Description |
|---|---|
--project-id <id> | Project ID (required) |
--dry-run | Preview changes without applying (apply only) |
--api-key <key> | API key (or use configured key) |
Supported Providers
| Provider | Python | JavaScript/TypeScript |
|---|---|---|
| OpenAI | Yes | Yes |
| Anthropic | Yes | Yes |
| Google AI | Yes | Yes |
| Cohere | Yes | Yes |
| AWS Bedrock | Yes | Yes |
| Azure OpenAI | Yes | Yes |
| Mistral | Yes | Yes |
| Groq | Yes | Yes |
Configuration
.promptguardrc
Create a config file in your project root:
Environment Variables
| Variable | Description |
|---|---|
PROMPTGUARD_API_KEY | API key for init command |
PROMPTGUARD_LOG_LEVEL | debug, info, warn, error |
NO_COLOR | Disable colored output |
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
Automated scanning in CI
VS Code Extension
See findings in your editor