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

opencode-notification-macos

v1.0.4

Published

Native macOS notifications and sounds for OpenCode - zero dependencies

Readme

opencode-notification-macos

Native macOS notifications and sounds for OpenCode - zero external dependencies.

npm version License: MIT

Features

🔔 Native macOS Notifications - Uses osascript for system notifications
🔊 System Sounds - Uses afplay with all 14 built-in macOS sounds
⚙️ Configurable - Per-event sound customization
📁 Dual Config - Global + project-level configuration
🎯 Zero Dependencies - No external libraries, just native macOS commands

Installation

For AI Agents (Automated Setup)

If you're an AI agent setting this up for a user, run these commands:

# 1. Install the plugin globally
npm install -g opencode-notification-macos

# 2. Configure default sounds interactively
npx opencode-notification-macos config

# 3. Add to OpenCode configuration
cat >> ~/.config/opencode/opencode.jsonc << 'EOF'
{
  "plugin": [
    "opencode-notification-macos"
  ]
}
EOF

Manual Installation

npm install -g opencode-notification-macos

Then add to your ~/.config/opencode/opencode.jsonc:

{
  "plugin": [
    "opencode-notification-macos"
  ]
}

Configuration

Interactive Configuration (Recommended)

# Configure sounds interactively
npx opencode-notification-macos config

# List available sounds
npx opencode-notification-macos list

# Preview a sound
npx opencode-notification-macos preview

# Show current configuration
npx opencode-notification-macos show

# Reset to defaults
npx opencode-notification-macos reset

Configuration Files

The plugin supports two configuration locations (project config overrides global):

Global (applies to all projects):

~/.config/opencode/opencode-notification-macos.json

Project (applies to specific project):

.opencode/notification.json

Configuration Format

{
  "sound": true,
  "notification": true,
  "showProjectName": true,
  "events": {
    "complete": { "sound": true, "notification": true },
    "error": { "sound": true, "notification": true },
    "question": { "sound": true, "notification": true },
    "permission": { "sound": true, "notification": true },
    "subagent_complete": { "sound": false, "notification": false }
  },
  "messages": {
    "complete": "✅ Task completed",
    "error": "❌ Error occurred",
    "question": "❓ OpenCode needs your input",
    "permission": "🔐 Permission required",
    "subagent_complete": "Subagent finished"
  },
  "sounds": {
    "complete": "Glass",
    "error": "Basso",
    "question": "Ping",
    "permission": "Tink",
    "subagent_complete": "Pop"
  }
}

Available Sounds

All 14 macOS system sounds are available:

  • Basso - Low alert sound
  • Blow - Airy whoosh
  • Bottle - Cork pop
  • Frog - Frog croak
  • Funk - Funk guitar riff
  • Glass - Glass tap (default for completion)
  • Hero - Heroic fanfare
  • Morse - Morse code beeps
  • Ping - Simple ping (default for questions)
  • Pop - Pop sound
  • Purr - Cat purr
  • Sosumi - Classic Mac sound
  • Submarine - Sonar ping
  • Tink - Light bell (default for permissions)

Events

The plugin triggers on these OpenCode events:

| Event | Description | Default Sound | |-------|-------------|---------------| | complete | Main task finished | Glass | | error | An error occurred | Basso | | question | OpenCode needs input | Ping | | permission | Permission required | Tink | | subagent_complete | Background task finished | Pop |

AI Agent Setup Instructions

If you are an AI assistant reading this to set up the plugin for a user, follow these exact steps:

Step 1: Check Prerequisites

# Verify macOS
sw_vers -productName

# Verify OpenCode is installed
which opencode

Step 2: Install Plugin

npm install -g opencode-notification-macos

Step 3: Create Configuration

Option A - Interactive (recommended):

npx opencode-notification-macos config

Option B - Create config file directly:

mkdir -p ~/.config/opencode
cat > ~/.config/opencode/opencode-notification-macos.json << 'EOF'
{
  "sound": true,
  "notification": true,
  "showProjectName": true,
  "sounds": {
    "complete": "Glass",
    "error": "Basso",
    "question": "Ping",
    "permission": "Tink",
    "subagent_complete": "Pop"
  }
}
EOF

Step 4: Update OpenCode Config

# Read current config
cat ~/.config/opencode/opencode.jsonc

# Add plugin to the plugin array
# If opencode.jsonc exists, add "opencode-notification-macos" to the plugin array
# If it doesn't exist, create it with the plugin

Step 5: Test

# Test sound
npx opencode-notification-macos preview

# Test with OpenCode
opencode "say hello and wait for my response"

Troubleshooting

No sound playing?

  1. Check system volume:

    afplay /System/Library/Sounds/Glass.aiff
  2. Check notification permissions:

    • System Settings → Notifications → Script Editor
    • Ensure notifications are enabled
  3. Verify config:

    npx opencode-notification-macos show

Plugin not loading?

  1. Check OpenCode config syntax:

    cat ~/.config/opencode/opencode.jsonc
  2. Clear OpenCode cache:

    rm -rf ~/.cache/opencode
  3. Restart OpenCode

Permission denied errors?

The plugin uses osascript for notifications. Grant permissions:

  • System Settings → Privacy & Security → Automation
  • Ensure your terminal has permission to control System Events

Development

# Clone repository
git clone https://github.com/evanstinger/opencode-notification-macos.git
cd opencode-notification-macos

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Type check
npm run typecheck

How It Works

This plugin replaces external notification libraries with native macOS commands:

  • Sounds: Uses afplay (built into macOS) to play system sounds from /System/Library/Sounds/
  • Notifications: Uses osascript (AppleScript) to display native macOS notifications
  • Zero Dependencies: No npm packages required for core functionality

License

MIT © Evan Stinger

Contributing

Contributions welcome! Please read the contributing guide first.

Related