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 🙏

© 2025 – Pkg Stats / Ryan Hefner

notify-claude-code

v1.0.4

Published

Claude Code Advanced Notification System - Monitor sessions and deliver notifications about cost, tokens, and code changes

Readme

Claude Code 通知システム

Claude Codeのセッション情報(コスト、トークン使用量、コード変更など)を自動収集し、macOS通知を配信するシステム

インストール

NPMパッケージとして使用(推奨)

# npx経由で直接実行
npx notify-claude-code --status

# グローバルインストール
npm install -g notify-claude-code

ローカル開発

cd ~/.claude-monitor
npm install
npm run build
npm link

クイックスタート

# セッション完了通知
npx notify-claude-code

# 詳細通知
npx notify-claude-code --mode detailed

# ステータス確認
npx notify-claude-code --status

主な機能

収集される情報

  • コスト(セッション毎の料金)
  • トークン使用量(入力/出力/キャッシュ)
  • 実行時間
  • コード変更(追加/削除行数)

通知モード

  • compact: コンパクトな単一通知(デフォルト)
  • detailed: 詳細な情報を含む通知
  • all: 該当する全ての通知を送信

通知の種類

  • セッション完了通知
  • 高コスト警告(閾値超過時)
  • トークンマイルストーン
  • 大規模コード変更

Claude Code Hooks設定

~/.claude/settings.jsonに追加してセッション終了時に自動通知:

{
  "hooks": {
    "Stop": [{
      "hooks": [{
        "type": "command",
        "command": "npx notify-claude-code --mode compact"
      }]
    }],
    "SessionEnd": [{
      "hooks": [{
        "type": "command",
        "command": "npx notify-claude-code --mode detailed"
      }]
    }]
  }
}

基本コマンド

# 通知の送信
npx notify-claude-code                              # compact通知
npx notify-claude-code --mode detailed              # 詳細通知
npx notify-claude-code --mode all                   # 全通知
npx notify-claude-code --custom "タイトル" "メッセージ"  # カスタム通知

# 設定管理
npx notify-claude-code --status                     # ステータス確認
npx notify-claude-code --enable                     # 有効化
npx notify-claude-code --disable                    # 無効化

# デバッグ
npx notify-claude-code --debug                      # デバッグモード

設定ファイル

~/.claude-monitor/notification_config.json

{
  "enabled": true,
  "mode": "compact",
  "cost_threshold": 1.0,
  "large_change_threshold": 100,
  "long_session_minutes": 30,
  "enable_milestones": true,
  "enable_warnings": true,
  "quiet_hours": {
    "enabled": false,
    "start": "22:00",
    "end": "08:00"
  }
}

アーキテクチャ

~/.claude/projects/{project}/*.jsonl
  ↓
SessionMonitor (セッション情報解析)
  ↓
NotificationTemplates (メッセージ生成)
  ↓
NotificationSystem (通知配信)
  ↓
macOS通知

主要コンポーネント

  • SessionMonitor: セッションデータの解析・集計
  • NotificationTemplates: 通知メッセージの生成
  • NotificationSystem: 通知の配信とログ記録
  • SecurityValidator: セキュリティ検証

terminal-notifier(推奨)

より高機能な通知のため、terminal-notifierのインストールを推奨:

brew install terminal-notifier

トラブルシューティング

通知が表示されない

# ステータス確認
npx notify-claude-code --status

# テスト通知
npx notify-claude-code --custom "テスト" "これはテストです"

# デバッグモード
npx notify-claude-code --debug

macOS設定:システム環境設定 > 通知 > ターミナル > 「通知を許可」をON

セッション情報が表示されない

Claude Codeで実際に作業を行い、APIコールが発生した後にデータが記録されます。

# セッション情報を確認
python3 ~/.claude-monitor/scripts/session_monitor.py

ログファイル

  • 通知ログ: ~/.claude-monitor/logs/notifications.log
  • セッションログ: ~/.claude-monitor/logs/sessions_YYYYMM.log
  • スナップショット: ~/.claude-monitor/cache/session_*.json

セキュリティとプライバシー

  • 全データはローカルに保存
  • ネットワーク通信なし
  • 外部サービスへの送信なし
  • 危険なコマンドパターンの自動検出

システム要件

  • macOS 10.14以降
  • Python 3.6以降
  • Node.js 14.0以降
  • オプション: terminal-notifier

ライセンス

MIT