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

@sammons/code-outline-hook

v2.0.0

Published

Code outline hook for Claude Code using code-outline-cli

Readme

@sammons/code-outline-hook

A Claude Code hook that generates code structure outlines using the @sammons/code-outline-cli tool. This hook automatically runs at session start to provide Claude with an understanding of your codebase structure.

Features

  • Automatic project detection: Intelligently detects TypeScript, JavaScript, React, and Node.js projects
  • Smart glob patterns: Generates appropriate file patterns based on project type
  • Flexible output formats: Supports ASCII, JSON, and YAML output formats
  • Configurable depth: Control how deep the analysis goes
  • Auto-installation: Automatically installs code-outline-cli if not available
  • Error handling: Graceful handling of edge cases and errors

Installation

npm install @sammons/code-outline-hook

Usage

This hook is designed to be used with the Claude Good Hooks CLI. The package provides multiple hooks that can be accessed through deep imports:

Default Hook

# Apply the default hook with default settings (ASCII format)
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline

# Apply with JSON format and depth limit
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline --format json --depth 3

# Apply with all nodes included
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline --includeAll true

# Apply with custom file patterns
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline --customPatterns "**/*.ts,**/*.js,!node_modules/**"

Specialized Hooks via Deep Imports

The package exports several pre-configured hooks that can be accessed using deep imports:

# Minimal outline - only shows top 2 levels
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline/minimal

# Detailed outline - includes all nodes with JSON output
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline/detailed

# TypeScript-specific outline - only analyzes .ts and .tsx files
claude-good-hooks apply --project @sammons/claude-good-hooks-code-outline/typescript

Available Exports

  • Default/Main Hook (@sammons/claude-good-hooks-code-outline): Full-featured configurable hook
  • Minimal (/minimal): Pre-configured for minimal output (depth=2, ASCII format)
  • Detailed (/detailed): Pre-configured for detailed analysis (JSON format, all nodes included)
  • TypeScript (/typescript): Pre-configured for TypeScript-only projects

Configuration Options

The hook supports the following custom arguments:

format

  • Type: string
  • Default: 'ascii'
  • Options: 'ascii', 'json', 'yaml'
  • Description: Output format for the code outline

depth

  • Type: number
  • Default: undefined (no limit)
  • Description: Maximum depth to scan in the code structure

includeAll

  • Type: boolean
  • Default: false
  • Description: Include all nodes in the outline (including typically filtered ones)

autoDetectProject

  • Type: boolean
  • Default: true
  • Description: Automatically detect project type and use appropriate file patterns

customPatterns

  • Type: string
  • Default: undefined
  • Description: Custom glob patterns to override auto-detection (comma-separated)

Project Type Detection

The hook automatically detects your project type and applies appropriate file patterns:

  • TypeScript React: **/*.{ts,tsx} + React dependencies detected
  • TypeScript: **/*.ts + TypeScript config/dependencies detected
  • JavaScript React: **/*.{js,jsx} + React dependencies detected
  • Node.js: **/*.{js,mjs} + package.json present
  • JavaScript: **/*.js for general JavaScript projects
  • Mixed: **/*.{js,ts,jsx,tsx} for projects with both JS and TS files

All patterns automatically exclude common build and dependency directories like node_modules/, dist/, build/, and coverage/.

Generated Script

When applied, this hook creates a code-outline-hook.js script in your .claude/scripts/ directory. This script:

  1. Checks if @sammons/code-outline-cli is available
  2. Installs it globally if missing
  3. Detects your project structure
  4. Runs the appropriate code-outline command
  5. Provides formatted output for Claude to understand your codebase

Output Example

The hook generates output like this for Claude:

🔍 Analyzing codebase structure for: my-typescript-project
📁 Project Type: TypeScript project

🚀 Running: npx @sammons/code-outline-cli **/*.ts --format ascii

src/
├── components/
│   ├── Button.ts
│   │   ├── interface ButtonProps
│   │   └── function Button
│   └── Modal.ts
│       ├── interface ModalProps  
│       └── function Modal
├── utils/
│   └── helpers.ts
│       ├── function formatDate
│       └── function validateEmail
└── index.ts
    └── function main

================================================================================
✅ Code outline generated successfully for 1 pattern(s)
📊 Format: ASCII

Requirements

  • Node.js 20.0.0 or higher
  • The hook will automatically install @sammons/code-outline-cli if not present

License

MIT License - see LICENSE file for details.