npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@velar-dev/rules

v0.3.1

Published

Local rule catalog for Velar — 42 pre-execution risk detection rules (30 core rules across 6 categories, plus MCP/WebFetch/self-protection coverage), classification only, no content inspection.

Readme

@velar-dev/rules

The local rule catalog powering @velar-dev/cli's pre-execution risk classification for AI coding agents.

What is this package

@velar-dev/rules is a pure, dependency-light function: given a normalized operation (an operation type plus a file path or command string), it returns a rule ID and a risk level (allow / warn / critical). It never reads file content or prompt text — only operation metadata. See @velar-dev/cli's README for the full "what Velar sends vs. never sends" picture and how this fits into the PreToolUse hook flow.

Usage

import { evaluate } from '@velar-dev/rules'

const result = evaluate({ operationType: 'file_read', path: '/repo/.env' })
// { ruleId: 'env-file-protection', riskLevel: 'critical' }

You can also evaluate against a custom rule subset (useful for testing):

import { evaluate, RULES, type Rule } from '@velar-dev/rules'

const onlySecretsRules: Rule[] = RULES.filter((r) => r.category === 'secrets')
evaluate(operation, onlySecretsRules)

Rule catalog

42 detection rules total: 30 core rules across 6 categories (secrets, production_db, destructive_command, deploy, exfiltration, package_ci_config), plus MCP tool-call detection, WebFetch/WebSearch's secret-in-target check, Velar's own self-protection rule, three Bash-bypass rules added in 0.3.1 (bash-env-file-reference, decode-and-execute, inline-interpreter-exec), and an .env.example allow carve-out — see src/rules.ts's top-of-file comment for the exact breakdown. Also a default-allow fallback (not counted in the 42, since it's the absence of a match rather than a detection). Each Rule carries:

  • id — stable identifier, e.g. env-file-protection
  • category — one of the 6 categories above
  • name — Japanese display name (dashboard)
  • pattern — human-readable summary of what's matched (for docs; see src/rules.ts for the exact regex/logic)
  • riskLevel — allow | warn | critical
  • reason — Japanese explanation (Slack approval card)
  • reason_en — English explanation

The full table with every rule's pattern and reason is documented in @velar-dev/cli's README.

Rule ordering is part of the contract

evaluate() scans the catalog top-to-bottom and returns the first matching rule — this is deliberate, not an implementation detail. See the doc comment at the top of src/rules.ts before reordering or inserting rules; tests/rules-phase3.test.ts enforces this ordering with regression guards.

No-raw-data-sent contract

The 50ms local-judgement budget and the "metadata only, never content" contract are both covered by tests: tests/rules.test.ts and tests/rules-phase3.test.ts (includes the performance benchmark). The end-to-end wire-level enforcement of this contract (rejecting any field outside the allow-list) lives in @velar-dev/cli's zero-knowledge-contract test suite (the real, internal name of that specific test file — see the package page).

Development

pnpm install
pnpm --filter @velar-dev/rules build
pnpm --filter @velar-dev/rules test

License

MIT — see LICENSE.