Repository navigation
v2.0.1 - Universal AI Agent Dependency Guardrails, OSV Intelligence & CI Gate
LatestWhat's in PkgDiet v2.0.1
PkgDiet 2.0.1 is a local-first dependency policy gate and MCP server designed to stop AI coding agents from proposing, hallucinating, or installing risky, deprecated, abandoned, or vulnerable npm packages.
🛡️ Real Agent Enforcement (Pre-Execution Guardrails)
Most AI guardrails are just advisory text. PkgDiet v2.0.1 introduces active install interception using each agent's native hook APIs:
- Codex (OpenAI): Native
PreToolUseNode.js hook (.codex/hooks/) intercepts shell commands and returns structuredpermissionDecision: "deny"before npm commands run. - Claude Code: Native
PreToolUseinstall guard (.claude/hooks/) and full Claude Code Plugin support (.claude-plugin/,.mcp.json, skills, and/pkgdiet:check&/pkgdiet:auditslash commands). - Cursor: Always-applied
.cursor/rules/pkgdiet.mdcrule for Cursor 0.47+ enforcing pre-check before any install command is generated. - Windsurf, Cline & GitHub Copilot: Direct MCP integration providing
check_dependencytools at runtime.
🔍 Deep Supply-Chain Intelligence (100% Local & Free)
- OSV.dev Vulnerability Detection: Direct integration with OSV advisory databases. Includes explicit
osvCheckedverification tracking and configurablesecurityMode: "fail-closed"or"fail-open". - Typosquat Detection: Levenshtein-distance analysis against popular npm packages to catch deceptive names before installation.
- npm Provenance Verification: Inspects
dist.attestations.provenanceto verify cryptographically signed build origins. - Dependency Confusion Protection: Blocks
internalNamePrefixesfrom being pulled from public registries. - Exact Version Pinning: Forbids bare
npm installand unpinned ranges in agent sessions and CI.
🚀 Official GitHub Actions Marketplace Gate
Includes official action.yml for pull request dependency gating:
- Diffs PR packages against the base commit.
- Applies repository policy (
ALLOW/WARN/BLOCK). - Generates native SARIF reports for GitHub Code Scanning.
- uses: om-tajne/pkgdiet@v2.0.1
with:
environment: ci
fail-on: BLOCK⚡ Model Context Protocol (MCP)
Bundled MCP server via stdio supporting:
check_dependency: Deep inspection of a candidate package.check_dependencies: Batch checking with bounded concurrency (up to 50 packages).suggest_alternative: Recommends verified, maintained alternatives when a package fails policy.get_policy: Surfaces active repo constraints to the LLM.
🧪 Live Verification & One-Command Setup
Test PkgDiet in 5 seconds without configuring anything:
# Live enforcement demonstration
npx -y pkgdiet@2.0.1 demo
# Automated one-command setup for your repo & all agents
npx -y pkgdiet@2.0.1 init