How promptshield-io/promptshield works
PromptShield is a Unicode-threat detection and remediation ecosystem for AI prompts, spanning a reusable scanning engine, command-line/workspace workflows, and editor integrations. The principal workflow scans text or files, filters or reports threats, and offers fixes or sanitization. The website presents the product and an interactive Tiptap demo. Several connections come from imports or calls in sampled source; broader package capabilities are documented in the README, but unsampled implementations are represented only at their supported directory paths.
Main entry points: workspace.ts Workspace Scanning · main.ts CLI Commands · core.ts Detection Engine · lsp.ts Language Server
Components 24
Threat Detection
- Detection Engine
packages/core/src/core.ts - Unicode Rules
packages/core/src/invisible.ts - Injection Rules
packages/core/src/injection-patterns.ts - Smuggling Rules
packages/core/src/smuggling.ts - Trojan Rules
packages/core/src/trojan.ts
File Workflows
- CLI Commands
packages/cli/src/main.ts - Workspace Scanning
packages/workspace/src/workspace.ts - File Resolution
packages/workspace/src/resolve-files.ts - Scan Cache
packages/workspace/src/cache.ts - Ignore Filtering
packages/ignore/src/ignore.ts - Sanitization
packages/sanitizer/src/fix.ts
Editor Integrations
- Language Server
packages/lsp/src/lsp.ts - Workspace Editor Scans
packages/lsp/src/workspace-scanning.ts - Code Actions
packages/lsp/src/code-actions.ts - VS Code Extension
packages/vscode/src/extension.ts - Threat Decorations
packages/vscode/src/decoration-manager.ts - Tiptap Protection
packages/tiptap/src/plugin.ts - Tiptap Fix UI
packages/tiptap/src/hover.ts
Product Website
- Website Home
apps/web/src/app/(home)/page.tsx - Ecosystem Overview
apps/web/src/components/ecosystem-section.tsx - Quick Start
apps/web/src/components/quick-start-section.tsx - Tiptap Demo
apps/web/src/components/tiptap-demo-section.tsx - Try It Out
apps/web/src/components/try-it-out-section.tsx
Other components
- Developer
Connections 31
- Developer → CLI Commands: runs scans
README.md - Developer → VS Code Extension: installs extension
README.md - CLI Commands → Workspace Scanning: runs scan
packages/cli/src/main.ts - CLI Commands → File Resolution: resolves files
packages/cli/src/main.ts - CLI Commands → Ignore Filtering: creates checker
packages/cli/src/main.ts - CLI Commands → Detection Engine: scans text
packages/cli/src/main.ts - CLI Commands → Workspace Scanning: writes reports
packages/cli/src/main.ts - Workspace Scanning → Detection Engine: scans content
packages/workspace/src/workspace.ts - Workspace Scanning → Ignore Filtering: filters threats
packages/workspace/src/workspace.ts - Workspace Scanning → Sanitization: applies fixes
packages/workspace/src/workspace.ts - Workspace Scanning → File Resolution: resolves files
packages/workspace/src/workspace.ts - Workspace Scanning → Scan Cache: uses cache
packages/workspace/src/workspace.ts - Language Server → Detection Engine: scans documents
packages/lsp/src/lsp.ts - Language Server → Ignore Filtering: filters threats
packages/lsp/src/lsp.ts - Language Server → Code Actions: builds actions
packages/lsp/src/lsp.ts - Language Server → Workspace Editor Scans: dispatches workspace
packages/lsp/src/lsp.ts - Workspace Editor Scans → Detection Engine: scans files
packages/lsp/src/workspace-scanning.ts - Workspace Editor Scans → Workspace Scanning: uses workspace engine
- Code Actions → Sanitization: applies fixes
packages/lsp/src/code-actions.ts - VS Code Extension → Language Server: starts server
- VS Code Extension → Threat Decorations: updates highlights
- Tiptap Protection → Detection Engine: scans editor text
packages/tiptap/src/plugin.ts - Tiptap Fix UI → Tiptap Protection: uses plugin key
packages/tiptap/src/hover.ts - Tiptap Fix UI → Tiptap Protection: invokes fixes
packages/tiptap/src/hover.ts - Website Home → Ecosystem Overview: renders
apps/web/src/app/(home)/page.tsx - Website Home → Quick Start: renders
apps/web/src/app/(home)/page.tsx - Website Home → Tiptap Demo: renders
apps/web/src/app/(home)/page.tsx - Website Home → Try It Out: renders
apps/web/src/app/(home)/page.tsx - Quick Start → Detection Engine: demonstrates scanning
apps/web/src/components/quick-start-section.tsx - Tiptap Demo → Tiptap Protection: demonstrates integration
apps/web/src/components/tiptap-demo-section.tsx - Tiptap Demo → Detection Engine: demonstrates scanning
apps/web/src/components/tiptap-demo-section.tsx