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

@kkcode-app/opencode

v1.0.9

Published

Connect OpenCode to KKCode and send actionable iPhone notifications.

Downloads

1,316

Readme

@kkcode-app/opencode

KKCode 的 OpenCode 配套工具:它可将电脑上的 OpenCode 通过中继连接到手机,并作为 OpenCode 插件向 iPhone 发送提醒。

Install

cd cli
npm install

Usage

Default: spawn opencode serve for you

npx -y @kkcode-app/opencode@latest

This will:

  1. Spawn opencode serve on 127.0.0.1:<random-port>.
  2. Open a WebSocket tunnel to the relay.
  3. Print a QR code. In KKCode, open ServersScan tunnel QR code, then scan the terminal QR code.

Keep the terminal open while using the connection. The CLI reconnects after a temporary network loss. Use KKCode's manual server-address entry only for a normal LAN/Tailscale/OpenCode URL: a tunnel QR code contains a temporary access token and must be scanned.

Background service (macOS & Linux)

First run the tunnel in the foreground and scan its QR code in KKCode. Then install the tunnel as a background service so it auto-starts on login and auto-restarts on crash. On macOS it uses launchd (LaunchAgent), on Linux it uses a systemd user service. The CLI refuses a first-time --install, because the QR code would only be written to the service log instead of your terminal.

npx -y @kkcode-app/opencode@latest --install

The first time you run --install it captures the current PATH and the absolute paths of node and opencode, so the background service can find them even though the service manager does not source your shell profile.

Other commands:

npx -y @kkcode-app/opencode@latest --status     # check if installed/loaded/running
npx -y @kkcode-app/opencode@latest --restart    # restart the background service
npx -y @kkcode-app/opencode@latest --uninstall  # stop and remove the service

Logs are written to ~/.config/kkcode/tunnel/tunnel.log. The tunnel code and shared secret are persisted across restarts, so your phone stays connected without re-scanning as long as the relay session hasn't expired. If a legacy ~/.config/opencode-tunnel/config.json exists, it is migrated automatically on first run.

Attach to an already running opencode serve

opencode serve --port 4096 &
npx -y @kkcode-app/opencode@latest --attach --port 4096

Flags

| Flag | Description | Default | | ----------------- | --------------------------------------------------------------------- | ------------------------------------------------- | | --relay <url> | Relay base URL (ws:// or wss://) | $OPENCODE_RELAY_URL or wss://relay.kkcode.app | | --port <n> | Port for opencode serve (random free port if omitted) | random | | --hostname <h> | Local hostname for opencode serve | 127.0.0.1 | | --attach | Don't spawn — reuse an existing opencode serve | off | | --command <bin> | Binary to spawn | $OPENCODE_CMD or opencode | | --reset-tunnel | Forget the saved secret and create a new tunnel | off | | --install | Install as macOS LaunchAgent (background, auto-start on login) | off | | --uninstall | Remove the LaunchAgent and stop the background service | off | | --restart | Restart the background service (kickstart -k / systemctl restart) | off |

iPhone notifications

In KKCode, enable notifications and copy the generated command. It includes a phone-owned notification token, saves it to ~/.config/kkcode/notify.json, and registers @kkcode-app/opencode in ~/.config/opencode/opencode.json in one step. Restart OpenCode afterwards. Resetting the token in the app immediately invalidates every earlier command. | --status | Show whether the LaunchAgent is installed/loaded/running | off |

How it works

  • The CLI registers as a "host" on the relay over a single WebSocket.
  • The CLI generates a random shared secret and derives an opaque tunnel ID with SHA-256.
  • The phone hits https://relay.example.com/t/<tunnel-id>/... with the secret in a header. The relay forwards each request frame-by-frame over the WebSocket to the CLI, which then fetch()es the local opencode serve and streams the response back.
  • Streaming endpoints (SSE) pass through unchanged — chunks are forwarded as they arrive.

The secret is persisted in ~/.config/kkcode/tunnel/config.json so that restarting or reconnecting the CLI gets you the same tunnel without a second scan.

License

MIT.