Repository navigation
Releases
v2.0.1 - Universal AI Agent Dependency Guardrails, OSV Intelligence & CI Gate
What'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 initv2.0.0 — The MCP Release
Welcome to the biggest update to PkgDiet yet! This release transforms PkgDiet from a standalone CLI into a fully integrated AI guardrail via the Model Context Protocol (MCP).
🚀 Major Features
- Native MCP Server: PkgDiet now runs as a standard MCP server (
npx pkgdiet mcp), exposing tools likecheck_dependencyandsuggest_alternativeto compatible AI agents. - Universal Agent Compatibility: Works out-of-the-box with Claude Desktop, Claude Code, Cursor, Windsurf, Cline, CrewAI, and the Microsoft Agent Framework.
- Zero-Config Integrations: New
setupandagent-setupcommands automatically detect your environment and configure agent files for you. - Enhanced Policy Engine: Stricter enforcement against legacy, bloated, and deprecated packages to prevent AI hallucination loops.
- CI/CD Hardening: Updated GitHub Action workflows for evaluating PR lockfile drift against your
.pkgdietrc.jsonpolicy.
📦 Installation
# Evaluate a package
npx -y pkgdiet@2.0.0 check moment
# Run the MCP server
npx -y pkgdiet@2.0.0 mcpv1.2.0
PkgDiet v1.1.0 🥗 — 3x Faster Concurrency, --prod Flag & Accuracy Fixes
What's New in v1.1.0 🥗
Performance & Scale
-3x Concurrency Boost: Increased parallel registry analysis to 15 concurrent workers (verified against 478 live packages with 0 rate limits).
- Interactive Progress: Real-time progress updates during health checks.
🛡️ Accuracy & Cleanliness
- Detection Accuracy Fix**: Fixed nested glob filtering (
/node_modules/) to prevent false-negative "used" dependency flags from internal node_modules require calls. --prod/--exclude-devFlag: Skip devDependencies when auditing production bundles (all dependencies scanned by default).- Upgraded
glob: Eliminated upstream deprecation warnings.