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

safe-webfetch

v0.1.8

Published

Claude Code permission prompt controller - auto allow/deny via pattern matching hooks

Readme

safe-webfetch

Rule-based auto-control for Claude Code permission prompts via pattern matching.

日本語

Why

Claude Code shows a permission prompt every time it accesses an external resource (URLs, etc.). Manually approving the same domains over and over interrupts your flow.

safe-webfetch uses Claude Code's Hooks to automatically allow or deny based on predefined rules, eliminating repetitive prompts.

It also features template learning — once you approve a URL, the tool extracts the domain or package name and auto-generates rules so future requests to the same pattern are allowed automatically.

How it works

PreToolUse hook   → match rules → allow / pass (no match)
PostToolUse hook  → template learning → append new rules to permission.json
  • PreToolUse: Evaluates rules from config.json5 (manual) then permission.json (auto-generated). If a rule matches, the request is allowed. If no rule matches, Claude Code shows its normal permission prompt.
  • PostToolUse: Extracts placeholders from approved URLs using template definitions and generates new allow rules.

Installation

mise (recommended)

mise use ubi:shoppingjaws/safe-webfetch

Downloads a precompiled binary from GitHub Releases. No runtime dependencies required.

npm (requires Bun runtime)

npm install -g safe-webfetch

Requires Bun to be installed, as the package uses Bun-specific APIs.

Build from source

git clone https://github.com/shoppingjaws/safe-webfetch.git
cd safe-webfetch
bun install
bun run build   # → dist/safe-webfetch
cp dist/safe-webfetch ~/.local/bin/

Setup

safe-webfetch init

This will:

  1. Create $XDG_CONFIG_HOME/safe-webfetch/config.json5 with default templates
  2. Register PreToolUse / PostToolUse hooks in ~/.claude/settings.json

Configuration

Config files live in $XDG_CONFIG_HOME/safe-webfetch/ (defaults to ~/.config/safe-webfetch/).

config.json5 — Manual rules and templates

{
  // Manual rules: glob pattern matching (matched URLs are auto-allowed)
  rules: [
    "https://docs.example.com/**",
  ],

  // Templates: used for auto-learning in PostToolUse
  templates: [
    {
      match: "https://github.com/{org}/**",
      generate: [
        "https://github.com/{org}/**",
        "https://raw.githubusercontent.com/{org}/**",
      ],
    },
  ],
}

permission.json — Auto-generated rules

Generated automatically by the PostToolUse hook based on templates. No manual editing required.

{
  "rules": [
    "https://github.com/anthropics/**",
    "https://raw.githubusercontent.com/anthropics/**"
  ]
}

Pattern syntax

Rule patterns use glob syntax:

| Pattern | Meaning | |---------|---------| | * | Matches any string except / | | ** | Matches any string including / (crosses directories) | | ? | Matches any single character except / |

Template {placeholder} captures a single path segment (no /) and expands it into generate patterns.

Rule evaluation order

  1. config.json5 rules (manual)
  2. permission.json rules (auto-generated)

If a rule matches, the request is allowed. If no rule matches, Claude Code shows its normal permission prompt.

Default templates

safe-webfetch init generates templates for:

  • GitHubgithub.com/{org}/** + raw.githubusercontent.com/{org}/**
  • docs.* sitesdocs.{domain}/** (AWS, Datadog, GCP, etc.)
  • npmwww.npmjs.com/package/{pkg}/** + registry.npmjs.org/{pkg}/**
  • npm (scoped)www.npmjs.com/package/@{scope}/{pkg}/** + registry.npmjs.org/@{scope}/{pkg}/**
  • PyPIpypi.org/project/{pkg}/**
  • crates.iocrates.io/crates/{crate}/** + docs.rs/{crate}/**
  • pkg.go.devpkg.go.dev/{module}/**

Commands

| Command | Description | |---------|-------------| | safe-webfetch init | Create config + register hooks | | safe-webfetch hook | PreToolUse hook (reads tool input from stdin) | | safe-webfetch post-hook | PostToolUse hook (template learning) | | safe-webfetch log show [-n N] | Show recent log entries |

Development

bun test              # Run tests
bun run typecheck     # Type check
bun run lint:check    # Lint
bun run format:check  # Format check
bun run format        # Apply formatting
bun run build         # Compile

License

MIT