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

hooksmithcli

v0.1.0

Published

CLI for authoring, testing, and debugging Claude Code hooks

Readme

hooksmith

CLI for authoring, testing, and debugging Claude Code hooks.

Install

npm install -g hook-smith

Commands

hooksmith list

Show all configured hooks from ~/.claude/settings.json.

hooksmith list
PreToolUse
  .*  →  command: ~/.claude/hooks/gate-exploration.sh
  .*  →  http: http://localhost:9800/gate

PostToolUse
  .*  →  http: http://localhost:9800/receipt
  .*  →  command: ~/.claude/hooks/post-commit-reindex.sh

4 hooks across 2 events

hooksmith test <hook-file>

Test a hook against a sample payload.

# Quick payload builder
hooksmith test ~/.claude/hooks/gate.sh --tool Read --input '{"file_path": "/etc/passwd"}'

# Full payload from file
hooksmith test ~/.claude/hooks/gate.sh --payload payload.json

Output shows exit code, decision (allow/deny), timing, stdout, stderr, and parsed JSON output.

hooksmith validate

Validate all hook configurations in settings.json.

hooksmith validate

Checks:

  • Scripts exist and are executable
  • Matcher regex patterns are valid
  • Required fields present per hook type

Returns exit code 1 if any errors found.

hooksmith init

Scaffold a new hook from templates.

hooksmith init

Interactive prompts for hook name, event type (PreToolUse/PostToolUse), and language (bash). Creates the script file at ~/.claude/hooks/ with the correct stdin/stdout/exit code patterns.

Hook Format

Claude Code hooks receive JSON on stdin and communicate decisions via exit codes.

PreToolUse (gating):

  • Exit 0 = allow the tool call
  • Exit 2 = deny the tool call (stderr = reason)

PostToolUse (logging):

  • Exit 0 = acknowledged

Input payload:

{
  "tool_name": "Read",
  "tool_input": {
    "file_path": "/home/user/project/src/index.ts"
  }
}

Example hook script:

#!/usr/bin/env bash
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""')

if [[ "$TOOL_NAME" == "Bash" ]]; then
  echo "Bash not allowed in this state" >&2
  exit 2
fi

exit 0

Error Handling

All operations return Result<T, HooksmithError> from @valencets/resultkit. Error codes: IO_FAILED, PARSE_FAILED, SETTINGS_NOT_FOUND, INVALID_CONFIG, HOOK_TIMEOUT, HOOK_CRASHED, SPAWN_FAILED, SCRIPT_NOT_FOUND, SCRIPT_NOT_EXECUTABLE, INVALID_REGEX.

Requirements

  • Node.js >= 22
  • ESM only

License

MIT