Skip to content

v2.0.1 - Universal AI Agent Dependency Guardrails, OSV Intelligence & CI Gate

Latest

Choose a tag to compare

@om-tajne om-tajne released this 31 Oct 16:01
· 1 commit to main since this release

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 PreToolUse Node.js hook (.codex/hooks/) intercepts shell commands and returns structured permissionDecision: "deny" before npm commands run.
  • Claude Code: Native PreToolUse install guard (.claude/hooks/) and full Claude Code Plugin support (.claude-plugin/, .mcp.json, skills, and /pkgdiet:check & /pkgdiet:audit slash commands).
  • Cursor: Always-applied .cursor/rules/pkgdiet.mdc rule for Cursor 0.47+ enforcing pre-check before any install command is generated.
  • Windsurf, Cline & GitHub Copilot: Direct MCP integration providing check_dependency tools at runtime.

🔍 Deep Supply-Chain Intelligence (100% Local & Free)

  • OSV.dev Vulnerability Detection: Direct integration with OSV advisory databases. Includes explicit osvChecked verification tracking and configurable securityMode: "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.provenance to verify cryptographically signed build origins.
  • Dependency Confusion Protection: Blocks internalNamePrefixes from being pulled from public registries.
  • Exact Version Pinning: Forbids bare npm install and 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