Package Detector acts as a security gatekeeper for developers, wrapping npm and pip installation commands to analyze packages for malicious behavior before they are installed locally.
- Multi-Registry Support: Automatically handles NPM and PyPI ecosystems.
- Security Analysis: Uses AST parsing and RAG-based threat modeling to detect risky patterns.
- Interactive Prompts: Blocks high-risk packages and asks for user confirmation.
- Premium CLI UX: Uses
richfor beautiful reports andquestionaryfor smooth interactions.
The recommended way to install Package Detector is using the provided installation script, which sets up an isolated virtual environment.
# Clone the repository
git clone https://github.com/teamoptimadev/package-detection-cli.git
cd package-detection-cli
# --- FOR MAC / LINUX ---
bash scripts/install.sh
# --- FOR WINDOWS (PowerShell) ---
powershell.exe -ExecutionPolicy Bypass -File .\scripts\install.ps1Users can install Package Detector without cloning the repo using these commands:
macOS / Linux (Bash):
curl -sSL https://raw.githubusercontent.com/teamoptimadev/package-detection-cli/main/scripts/install.sh | bashWindows (PowerShell):
iwr -useb https://raw.githubusercontent.com/teamoptimadev/package-detection-cli/main/scripts/install.ps1 | iexPost-installation:
If ~/.local/bin is not in your PATH, add it to your profile (~/.zshrc or ~/.bashrc):
export PATH="$PATH:$HOME/.local/bin"Intercept any installation command:
pd install react
# or
pd i numpyForce a specific registry if heuristic detection fails:
pd install --npm some-package
pd install --pip some-python-packageUse pd as a prefix for standard installers:
pd npm install lodash
pd pip install flaskAnalyze a package without triggering the installer:
pd scan --registry npm cross-env- Command Intercept:
pdcaptures the package name and intent. - Download & Extract: Downloads the package metadata and source code to a temporary sandbox.
- Behavior Extraction: Performs AST analysis to extract sensitive function calls and system interactions.
- RAG Match: Compares extracted behaviors against a vector database of known malicious patterns.
- AI Reasoning: A reasoning module summarizes the risk and provides a verdict (
SAFE,SUSPICIOUS,MALICIOUS). - Gatekeeping: If the verdict is risky, it prompts the user. If verified safe, it executes the system's actual
npm/pipbinary.
Built by Package Detector Team. Stay Safe! 🛡️