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

@stand-e/opencode-slackcode

v0.3.45

Published

OpenCode plugin that streams session and agent activity into Slack.

Downloads

5,968

Readme

SlackIDE

SlackCode is an OpenCode plugin that streams session and agent activity to Slack.

Requirements

  • OpenCode >= 1.2.25
  • Node.js >= 18 (CI uses Node 24)
  • Slack app credentials (xoxb-... bot token)

Quick Start (Recommended)

Install the plugin with OpenCode:

opencode plugin add @stand-e/opencode-slackcode

Then configure either environment variables or .slackcode.

Option A: Environment Variables (fastest)

export SLACK_CHANNEL=C123456
export SLACK_BOT_TOKEN=xoxb-xxx
# Only needed for bidirectional mode (/opencode slash command):
export SLACK_APP_TOKEN=xapp-xxx

Option B: .slackcode file

Create .slackcode in project root:

channel: C123456
bot_token: xoxb-xxx
app_token: xapp-xxx
flush_interval_sec: 1.5
message_chunk_limit: 2000
state_path: .opencode/slack_state.json
log_level: info

Config precedence is: .slackcode first, then environment variables.

Usage

Start OpenCode normally. SlackCode will:

  1. Post a single startup status message when the plugin comes online
  2. Create one Slack root message per OpenCode session
  3. Post the triggering user prompt into that session's thread
  4. Stream session context and final agent output into that session's thread
  5. In bidirectional mode, let /opencode create a session shell and let thread buttons choose Plan or Build
  6. Post Session finished on session.idle or session.deleted

Modes

One-way streaming (default)

OpenCode events -> Slack.

Bidirectional (slash command)

Use createBidirectionalPlugin() and enable Socket Mode:

import { createBidirectionalPlugin } from "@stand-e/opencode-slackcode/bidirectional";

const plugin = await createBidirectionalPlugin({
  projectRoot: ".",
  opencodeVersion: "1.2.25",
  enableSocketMode: true,
});

For this mode, set SLACK_APP_TOKEN (xapp-...). @slack/socket-mode is already bundled as a transitive dependency of the plugin.

Current Slack control model:

  • /opencode <task> creates the Slack session thread
  • Plan and Build buttons inside that thread choose how OpenCode should run the task
  • Cancel stops the session
  • Slack thread replies are routed back into the matching OpenCode session through client.session.prompt(...)
  • Custom Slack slash commands cannot be invoked inside Slack threads, so mode switching lives on buttons instead of nested /opencode calls

Log levels: debug, info, warn, error (default info, configured via .slackcode only).

When the plugin needs to refer back to the running OpenCode instance, it should prefer the serverUrl provided by OpenCode at plugin startup. OpenCode does not default to a fixed port. An explicit port like 4096 is only useful for manual debugging when you choose to launch OpenCode with --port.

Slack App Checklist

  • Invite bot user to target channel
  • Scopes: chat:write (and files:write for long-output uploads)
  • For private channels, invite bot explicitly

Troubleshooting

If no messages appear in Slack:

  • Verify channel ID and bot membership
  • Verify token values (SLACK_BOT_TOKEN, optional SLACK_APP_TOKEN)
  • Ensure config is loaded from the project root (env or .slackcode)

Development

Build:

npm run build

Publish package:

npm publish --access public

Notes

  • State is persisted to .opencode/slack_state.json by default.
  • Long output is uploaded as a file when it exceeds message_chunk_limit.
  • A startup dedupe marker is written to .opencode/slackcode-startup.json to suppress duplicate startup notifications during rapid reinitialization.

Compatibility Layers We Keep

These are still in the code on purpose:

  • slackcode.cjs and bidirectional.cjs CommonJS shims: OpenCode package loading is still sensitive to entry-point shape, so we keep explicit CJS bridges for hosts that do not consume the ESM exports cleanly.
  • Legacy event field extraction: Older one-way event payloads still use fields like session.id, sessionId, session_id, message.text, and message.delta. We keep those readers so the plugin still works across older OpenCode event shapes while the modern structured properties.* events drive the new assistant-only aggregation path.
  • Startup dedupe marker: OpenCode may initialize the plugin more than once during startup. The short-lived .opencode/slackcode-startup.json marker prevents duplicate "plugin started" notices in Slack.

Compatibility layers we intentionally are not keeping:

  • TUI-only session targeting: We do not depend on undocumented TUI session-selection methods. Slack thread replies are sent to the mapped OpenCode session through the supported session API instead of trying to impersonate a foreground TUI keystroke.
  • Token-by-token Slack streaming: Intermediate reasoning and partial text updates are suppressed. Slack receives the user prompt, session context, and final assistant output instead.