PromptGuard VS Code Extension
Drop-in LLM security for your applications - directly in VS Code.
Features
- LLM SDK Detection: Automatically detects OpenAI, Anthropic, Cohere, and HuggingFace SDKs in your code
- Status Indicator: See PromptGuard status at a glance in the status bar
- One-Click Setup: Initialize PromptGuard with a single command
- Real-time Diagnostics: Get warnings when LLM SDKs are detected
- CLI Integration: Seamlessly wraps the PromptGuard CLI
Requirements
- VS Code 1.80.0 or higher
- PromptGuard CLI installed (see Installation)
Installation
1. Install the PromptGuard CLI
curl -fsSL https://raw.githubusercontent.com/acebot712/promptguard-cli/main/install.sh | sh
Or install manually from GitHub Releases.
2. Install the Extension
- Open VS Code
- Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X)
- Search for "PromptGuard"
- Click Install
Or install from the command line:
code --install-extension promptguard.promptguard-vscode
Usage
Initialize PromptGuard
- Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
- Run
PromptGuard: Initialize
- Enter your API key when prompted
- Select providers (or press Escape to use all)
Scan for LLM SDKs
- Run
PromptGuard: Scan for LLM SDKs from Command Palette
- View results in the Output channel
Check Status
- Click the status bar indicator (bottom right)
- Or run
PromptGuard: Show Status from Command Palette
- Run
PromptGuard: Apply Transformations from Command Palette
- Confirm the action
- Your code will be automatically transformed to use PromptGuard
Configuration
CLI Path
If the CLI is not in your PATH, you can set a custom path:
- Open Settings (Cmd+, / Ctrl+,)
- Search for "PromptGuard"
- Set
PromptGuard: Cli Path to the full path to the binary
Example: /usr/local/bin/promptguard or C:\Program Files\PromptGuard\promptguard.exe
Commands
PromptGuard: Initialize - Set up PromptGuard in your project
PromptGuard: Scan for LLM SDKs - Scan project for LLM SDK usage
PromptGuard: Show Status - Display current configuration
PromptGuard: Apply Transformations - Apply PromptGuard transformations
PromptGuard: Disable - Temporarily disable PromptGuard
PromptGuard: Enable - Re-enable PromptGuard
Status Bar
The status bar shows:
- Active - PromptGuard is active and protecting your app
- Disabled - PromptGuard is temporarily disabled
- Not initialized - PromptGuard hasn't been set up yet
Click the status bar to view detailed status.
Supported Languages
- TypeScript (
.ts, .tsx)
- JavaScript (
.js, .jsx)
- Python (
.py)
Supported Providers
- OpenAI
- Anthropic
- Cohere
- HuggingFace
- Gemini (Google)
- Groq
Troubleshooting
CLI Not Found
If you see "CLI not found" errors:
- Verify the CLI is installed:
promptguard --version
- Check it's in your PATH:
which promptguard (macOS/Linux) or where promptguard (Windows)
- Set the
promptguard.cliPath setting to the full path
Extension Not Working
- Check the Output channel: View → Output → Select "PromptGuard"
- Reload the window: Cmd+Shift+P → "Developer: Reload Window"
- Check VS Code version: Must be 1.80.0 or higher
Links
License
Apache 2.0
| |