{"id":46682108,"url":"https://github.com/acebot712/promptguard-cli","last_synced_at":"2026-04-18T21:06:33.357Z","repository":{"id":319289350,"uuid":"1078221439","full_name":"acebot712/promptguard-cli","owner":"acebot712","description":"PromptGuard CLI - Drop-in LLM security for your applications. Built with Rust + Tree-sitter.","archived":false,"fork":false,"pushed_at":"2026-04-05T13:38:07.000Z","size":200,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T14:12:11.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acebot712.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-17T11:49:35.000Z","updated_at":"2026-04-05T13:38:10.000Z","dependencies_parsed_at":"2025-10-18T18:17:33.148Z","dependency_job_id":"1047ffa9-71ab-4503-8f94-3ae17c8958ac","html_url":"https://github.com/acebot712/promptguard-cli","commit_stats":null,"previous_names":["acebot712/promptguard-cli"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/acebot712/promptguard-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acebot712%2Fpromptguard-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acebot712%2Fpromptguard-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acebot712%2Fpromptguard-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acebot712%2Fpromptguard-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acebot712","download_url":"https://codeload.github.com/acebot712/promptguard-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acebot712%2Fpromptguard-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31984590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"ssl_error","status_checked_at":"2026-04-18T20:23:29.375Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-09T00:31:32.729Z","updated_at":"2026-04-18T21:06:33.314Z","avatar_url":"https://github.com/acebot712.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/acebot712/promptguard-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/acebot712/promptguard-cli/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/acebot712/promptguard-cli)](https://github.com/acebot712/promptguard-cli/blob/main/LICENSE)\n[![Rust](https://img.shields.io/badge/Built_with-Rust-orange)](https://www.rust-lang.org/)\n\n# PromptGuard CLI\n\n\u003e Drop-in LLM security for your applications — built with Rust + Tree-sitter\n\n![Version](https://img.shields.io/badge/version-1.5.1-blue)\n![Rust](https://img.shields.io/badge/rust-1.70+-orange?logo=rust)\n![License](https://img.shields.io/badge/license-Apache%202.0-green)\n\nSingle 5.3MB binary. No runtime interpreter required. Real AST transformations. Under 10ms startup.\n\n## Installation\n\n| Method | Command |\n|--------|---------|\n| **Homebrew** | `brew tap promptguard/tap \u0026\u0026 brew install promptguard` |\n| **Shell script** | `curl -fsSL https://raw.githubusercontent.com/acebot712/promptguard-cli/main/install.sh \\| sh` |\n| **Cargo** | `cargo install promptguard` |\n| **Binary** | Download from [GitHub Releases](https://github.com/acebot712/promptguard-cli/releases/latest) |\n\nSupported platforms: macOS ARM64 (M1/M2/M3), macOS x86_64, Linux x86_64, Linux ARM64.\n\n\u003e For an MCP-only install (no Rust required), use `pip install promptguard-mcp-server` instead.\n\n## Quick Start\n\n```bash\npromptguard init --api-key pg_sk_prod_YOUR_KEY    # Configure\npromptguard verify                                 # Test connectivity + scan + redact\npromptguard scan                                   # Find LLM SDK usage\npromptguard status                                 # Check configuration\npromptguard mcp -t stdio                           # Start MCP server\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `init` | Initialize PromptGuard and rewrite SDK constructors to route through proxy |\n| `scan` | Scan project for LLM SDK usage, or scan text/files for security threats |\n| `status` | Show current configuration and managed files |\n| `doctor` | Diagnose common issues |\n| `apply` | Apply pending code transformations |\n| `disable` / `enable` | Toggle PromptGuard on/off |\n| `revert` | Revert all changes (restores backups) |\n| `mcp` | Start MCP server for AI editor integration |\n| `redteam` | Red team testing (manual or `--autonomous` with LLM agent) |\n| `verify` | End-to-end integration check: connectivity, auth, scan, and redact |\n| `policy` | Policy-as-code: `apply`, `diff`, `export` YAML guardrail configs |\n| `login` / `logout` | Authenticate with PromptGuard cloud |\n| `whoami` | Show current authenticated user |\n| `projects` | `list` / `select` active project |\n| `config` | View or update local configuration |\n| `key` | Manage API keys |\n| `logs` | View recent security event logs |\n| `events` | View security events |\n| `dashboard` | Open the PromptGuard dashboard in browser |\n| `redact` | Redact PII from text |\n| `test` | Run a quick connectivity and detection test |\n| `update` | Update the CLI to latest version |\n\n## MCP Server\n\nThe CLI includes a native [Model Context Protocol](https://modelcontextprotocol.io) server:\n\n```bash\npromptguard mcp -t stdio\n```\n\n### Supported Transports\n\n| Transport | Command | Notes |\n|-----------|---------|-------|\n| **stdio** | `promptguard mcp -t stdio` | Default, used by all editors |\n\nFor Streamable HTTP transport, use the [standalone Python server](https://github.com/acebot712/promptguard/tree/main/mcp-server) (`pip install promptguard-mcp-server`).\n\n### Available Tools\n\n| Tool | Parameters | Description |\n|------|------------|-------------|\n| `promptguard_auth` | `api_key` (optional) | Save/validate API key |\n| `promptguard_logout` | — | Clear local credentials |\n| `promptguard_scan_text` | `text` (required) | Scan text for security threats |\n| `promptguard_scan_project` | `directory`, `provider` (optional) | Scan codebase for unprotected LLM SDK usage |\n| `promptguard_redact` | `text` (required) | Redact PII from text |\n| `promptguard_status` | — | Check config and API connectivity |\n\n### Client Configuration\n\n**Cursor** (`.cursor/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"promptguard\": {\n      \"command\": \"promptguard\",\n      \"args\": [\"mcp\", \"-t\", \"stdio\"]\n    }\n  }\n}\n```\n\n**Claude Code:**\n\n```bash\nclaude mcp add promptguard -- promptguard mcp -t stdio\n```\n\n**Gemini CLI:**\n\n```bash\ngemini mcp add -t stdio promptguard -- promptguard mcp -t stdio\n```\n\nFull setup instructions for 13+ clients: [docs.promptguard.co/tools/mcp](https://docs.promptguard.co/tools/mcp)\n\n## How the CLI Works\n\nThe CLI rewrites SDK constructors using Tree-sitter AST parsing (not regex):\n\n**Before:**\n```typescript\nconst openai = new OpenAI({\n  apiKey: process.env.OPENAI_API_KEY\n});\n```\n\n**After `promptguard init`:**\n```typescript\nconst openai = new OpenAI({\n  apiKey: process.env.PROMPTGUARD_API_KEY,\n  baseURL: \"https://api.promptguard.co/api/v1\"\n});\n```\n\nAll LLM requests now flow through PromptGuard's six-layer security pipeline.\n\n### Supported Providers\n\n| Provider | TypeScript | JavaScript | Python |\n|----------|:---:|:---:|:---:|\n| OpenAI | Yes | Yes | Yes |\n| Anthropic | Yes | Yes | Yes |\n| Cohere | Yes | Yes | Yes |\n| HuggingFace | Yes | Yes | Yes |\n| Gemini | Yes | Yes | Yes |\n| Groq | Yes | Yes | Yes |\n| AWS Bedrock | Yes | Yes | Yes |\n\n## Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `PROMPTGUARD_API_KEY` | — | API key (read by `init` and MCP tools) |\n| `PROMPTGUARD_BASE_URL` | `https://api.promptguard.co/api/v1` | API base URL |\n\nGlobal credentials are stored in `~/.promptguard/credentials.json`. Project-level configuration is stored in `.promptguard.json` in the project root.\n\n## Development\n\n```bash\ncargo build              # Debug build\ncargo build --release    # Optimized release (5.3MB)\ncargo test               # Run tests\n```\n\n### Project Structure\n\n```\nsrc/\n├── main.rs              # CLI entry point (Clap)\n├── scanner/             # Recursive file scanning\n├── detector/            # AST-based SDK detection (Tree-sitter)\n├── transformer/         # AST-based code transformation\n├── config/              # JSON configuration (Serde)\n├── backup/              # Backup/restore system\n├── api/                 # HTTP API client (Reqwest)\n└── commands/            # CLI commands (init, scan, mcp, redteam, policy)\n```\n\n## Uninstallation\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/acebot712/promptguard-cli/main/uninstall.sh | sh\n```\n\nOr manually: `sudo rm /usr/local/bin/promptguard \u0026\u0026 rm -rf ~/.promptguard`\n\n## Links\n\n- [Documentation](https://docs.promptguard.co/tools/cli)\n- [MCP Server Docs](https://docs.promptguard.co/tools/mcp)\n- [Homepage](https://promptguard.co)\n- [Dashboard](https://app.promptguard.co)\n\nApache 2.0 — See [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facebot712%2Fpromptguard-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facebot712%2Fpromptguard-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facebot712%2Fpromptguard-cli/lists"}