pkg-gate
Pre-install npm security gate where TypeSafe System One judges lifecycle scripts for intent, threat, secret access and remote execution.
Overview
pkg-gate is a pre-install security gate for npm lifecycle scripts using TypeSafe System One. Given a package name, a package.json path or a raw shell command, it extracts preinstall, install and postinstall hooks and evaluates each in parallel across intent, threat severity, secret access and remote execution, returning allow, warn or block. Structured output exposes typed distributions, for example a credential_access intent with 0.99 probability of accessing secrets for a known malicious package.
Low confidence (below 0.50) routes to human review instead of guessing. A CLI supports interactive prompts, registry packages, local package.json files, raw scripts, JSON and plain output, with exit codes 0 for allow, 1 for block and 2 for warn. Without TYPESAFE_API_KEY it falls back to an offline calibrated simulator. It can also check arbitrary shell strings before spawning child processes. MIT licensed.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | What is the intent of this lifecycle script? | — |
| Score | Threat severity | — |
| Yes / no | Does this script access secrets? | yes · no |
| Yes / no | Does it perform remote execution? | yes · no |
How it works
- Extract lifecycle scripts from a package.
- Evaluate each script in parallel with System One.
- Combine into allow, warn or block with reasons.
- Route low-confidence results to human review.
Strengths
- Catches supply-chain attacks before install scripts run.
- Typed, parseable output.
- CI-friendly exit codes.
Caveats
- Offline simulator is not the real model.
- Sends script contents to TypeSafe.
Getting started
npm install pkg-gate, export TYPESAFE_API_KEY, then npx pkg-gate esbuild.At a glance
- Type
- Hook
- Status
- beta
- Language
- JavaScript
- Runtime
- Node library, CLI
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
Pre-install security gate for npm lifecycle scripts using TypeSafe System One. Evaluates preinstall, install, and postinstall hooks across intent, threat severity, secret access, and remote execution to intercept supply-chain attacks before execution.
logicrw/awesome-jev-projectsPre-install security gate for npm lifecycle scripts using TypeSafe System One.
hellogumbo/awesome-jev
Frequently asked questions
What does pkg-gate check?
npm preinstall, install and postinstall scripts for intent, threat, secret access and remote execution.
What happens on low confidence?
It routes to human review.
Does it work without a key?
It falls back to an offline calibrated simulator.
Related projects
Claude Code PreToolUse layer where Jev answers YAML-defined questions about each tool call, with 19 hard rules and calibration runs.
ProjectbetaTypeScriptSafety gate plugin for Claude Code, Codex CLI and Antigravity: local sensitive-file checks, then Jev judges blast radius.
PluginbetaTypeScriptClaude Code mod that answers auto mode's tool-call permission question with eight Jev yes/no checks behind a shell-aware blocklist.
ProjectbetaTypeScriptRing Zero: kernel-level runtime security for AI agents, with Jev as an optional check that can only raise severity, never permit.
ServicebetaClaude Code hook that blocks known key formats locally and sends unknown high-entropy strings to Jev only in masked form.
HookbetaPythonClaude Code hook where Jev reviews each tool call against risk, authorization and scope questions and a local policy returns allow or deny.
ProjectbetaGo