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-telegram-plugin

v0.1.0

Published

Control OpenCode from your phone via Telegram. Send prompts, manage sessions, run shell commands, approve permissions, and execute any OpenCode slash command.

Readme

opencode-telegram-plugin

Control OpenCode from your phone via Telegram. Send prompts, manage sessions, run shell commands, approve permissions, and execute any OpenCode slash command -- all from a Telegram chat.

Installation

From npm (recommended)

Add to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-telegram-plugin"]
}

Or install globally in ~/.config/opencode/opencode.json.

OpenCode will automatically install the plugin using Bun.

Manual install

Copy telegram-plugin.ts to your plugins directory:

# Global
cp telegram-plugin.ts ~/.config/opencode/plugins/

# Project-specific
cp telegram-plugin.ts .opencode/plugins/

Then add the dependency to your package.json:

{
  "dependencies": {
    "node-telegram-bot-api": "^0.66.0"
  }
}

Setup

1. Create a Telegram bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts to name your bot
  3. Copy the bot token BotFather gives you

2. Get your chat ID

  1. Send any message to your new bot
  2. Open this URL in your browser (replace <TOKEN> with your bot token):
    https://api.telegram.org/bot<TOKEN>/getUpdates
  3. Find "chat":{"id":XXXXXXXX} in the response -- that number is your chat ID

3. Set environment variables

Add these to your shell profile (~/.zshrc, ~/.bashrc, etc.):

export TELEGRAM_BOT_TOKEN="your-bot-token"
export TELEGRAM_CHAT_ID="your-chat-id"

4. Restart OpenCode

The plugin loads at startup. You'll receive a "Connected!" message in Telegram when it's ready.

Features

  • Chat with OpenCode -- send any message as a prompt and get the full response back
  • All OpenCode commands -- every built-in and custom slash command is available as /oc_<name>
  • Shell commands -- run shell commands with /shell or the ! prefix
  • Session management -- create, list, switch, and abort sessions
  • Permission forwarding -- tool permission requests are forwarded to Telegram with yes/always/no options; reply with YES, ALWAYS, or NO to respond. Auto-denies after 5 minutes
  • File diff view -- see what files were changed in the current session
  • Auto-discovery -- custom commands defined in .opencode/commands/ or opencode.json are automatically registered in the Telegram bot menu at startup
  • Long message handling -- responses are split to fit Telegram's 4096 character limit
  • Error notifications -- session errors are forwarded to Telegram

Commands

Session management

| Command | Description | |---------|-------------| | /start | Show help and all available commands | | /new [title] | Create a new session | | /sessions | List recent sessions | | /switch <id> | Switch to a session by ID prefix | | /status | Show current session info | | /abort | Abort the running task | | /diff | Show files changed in the session | | /messages | Show the last 5 messages | | /commands | List all available OpenCode commands |

Shell

| Command | Description | |---------|-------------| | /shell <cmd> | Run a shell command | | !<cmd> | Inline shell (e.g. !git status) |

OpenCode built-in commands

All OpenCode slash commands are available with the /oc_ prefix:

| Command | Maps to | |---------|---------| | /oc_undo | /undo -- revert last message and file changes | | /oc_redo | /redo -- restore undone message | | /oc_compact | /compact -- summarize/compact the session | | /oc_share | /share -- share the session | | /oc_unshare | /unshare -- unshare the session | | /oc_init | /init -- create or update AGENTS.md | | /oc_models | /models -- list available models | | /oc_help | /help -- show OpenCode help |

Custom commands

Any custom commands you define in .opencode/commands/ or your opencode.json config are automatically discovered and registered. For example, if you have a /test command, it becomes /oc_test in Telegram.

Custom commands can accept arguments:

/oc_test --coverage

Permissions

When OpenCode needs permission to execute a tool (file edits, bash commands, etc.), the request is forwarded to Telegram with details about the tool. You can respond by:

  • Replying to the permission message with:
    • YES or Y - Approve once
    • ALWAYS or A - Always allow this pattern
    • NO or N - Deny
  • Sending YES, ALWAYS, or NO without replying (applies to most recent pending request)
  • Doing nothing - Requests auto-deny after 5 minutes

Use /pending to see any pending permission requests.

Environment variables

| Variable | Required | Description | |----------|----------|-------------| | TELEGRAM_BOT_TOKEN | Yes | Bot token from @BotFather | | TELEGRAM_CHAT_ID | Yes | Your Telegram chat ID |

If either variable is missing, the plugin logs a warning and disables itself.

Requirements

  • OpenCode v0.1+
  • Node.js 18+
  • node-telegram-bot-api npm package

License

MIT