pi-dependency-guard0.1.1
Hallucination detector & package security audit extension for Pi Coding Agent
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
๐ก๏ธ Overview
pi-dependency-guard prevents AI hallucinations and supply-chain vulnerabilities from entering your project through Pi Coding Agent.
LLMs commonly hallucinate non-existent package names when writing import statements or proposing installation commands (e.g. npm i fast-auth-helper-ai). Attackers actively exploit this via package hallucination typosquatting, registering fabricated names on npm and PyPI with malicious payloads.
pi-dependency-guard intercepts install commands and validates every dependency against the official registries in real time before execution.
โโโโโโโโโโโโโโโโโโโ proposes install โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ> โ โ
โ Pi Agent โ โ pi-dependency-guard โ
โ โ <โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โโโโโโโโโโโโโโโโโโโ risk evaluation โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
queries registry โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ npm / PyPI API โ
โ (404 -> Hallucinated) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โจ Features
- ๐ซ Zero Hallucinations: Instantly flags non-existent packages as
CRITICALrisk. - ๐ Direct Registry Verification: Hits official
registry.npmjs.organdpypi.orgendpoints without middlemen. - โณ Age & Download Analysis: Warns on packages newer than 7 days or with fewer than 100 monthly downloads.
- โก Multi-Ecosystem Parsing: Detects packages in
npm install,pnpm add,yarn add, andpip install. - ๐ค Agent Self-Audit Tool (
audit_package): Enables Pi to self-verify library existence before generating code.
๐ Installation
Via Pi Package Registry (Recommended)
pi install npm:pi-dependency-guard
Direct from GitHub
pi install git:https://github.com/lleontor705/pi-dependency-guard.git
From Local Source
git clone https://github.com/lleontor705/pi-dependency-guard.git
cd pi-dependency-guard
npm install && npm run build
pi install ./
๐ Usage & Commands
Slash Commands
| Command | Description |
|---|---|
/guard check npm <pkg> |
Queries the npm registry for release date, version, and monthly downloads. |
/guard check pypi <pkg> |
Queries PyPI for Python packages. |
/guard scan <command> |
Parses an entire command (e.g., npm i express lodash-es) and audits all packages. |
Agent Autonomous Tool (audit_package)
Pi uses this tool before proposing any unfamiliar library:
{
"packageName": "express-jwt-easy",
"ecosystem": "npm"
}
Response:
{
"packageName": "express-jwt-easy",
"ecosystem": "npm",
"exists": false,
"isHallucinated": true,
"riskLevel": "CRITICAL",
"reasons": [
"Package \"express-jwt-easy\" does NOT exist in the official npm registry (Hallucination detected)."
]
}
Pi immediately halts the hallucinated suggestion and proposes a real package like express-jwt.
๐๏ธ Architecture & Development
# Clone
git clone https://github.com/lleontor705/pi-dependency-guard.git
cd pi-dependency-guard
# Install & Build
npm install
npm run build
๐ License
MIT ยฉ Luis Leon