Send OpenCode events (permission requests, task completion, errors) as push notifications to your Apple Watch via Bark.
将 OpenCode 的权限请求、任务完成、错误等信息通过 Bark 推送到你的 Apple Watch。
- Zero-config push — set your Bark key once, forget it
- Per-event filtering — toggle permission / idle / error independently
- Custom sounds — different ringtones for different event types
- Web dashboard — GUI to manage all settings, no terminal needed
- Self-hosted support — use your own Bark server
- Apple Watch native — notifications appear on wrist automatically
OpenCode event -> Plugin -> Bark API -> APNs -> iPhone -> Apple Watch
permission.asked→ "OpenCode 权限请求"session.idle→ "OpenCode 任务完成"session.error→ "OpenCode 错误"
App Store: Bark - Custom Notifications
Open Bark app → copy the test URL → extract the key:
https://api.day.app/xqeb5G6i6EqQKY5ujxVRF/Test
^^^^^^^^^^^^^^^^^^^
This is your key
git clone https://github.com/CharlesMK16/OpenCode-to-IWatch.git D:/config/opencode/plugins/watch-bridge
cd D:/config/opencode/plugins/watch-bridge
bun install(1)Register the plugin in OpenCode:
Edit C:\Users\<you>\.config\opencode\opencode.jsonc:
(2)Launch the settings dashboard:
cd D:/config/opencode/plugins/watch-bridge
bun run dashboardThen open http://localhost:18921 in your browser. Enter your Bark device key, toggle which events to receive, pick sounds — all in a GUI. Click Save Settings.
You should see [watch-bridge] enabled: permission, idle, error in the terminal.
All configuration is done via Windows environment variables. There are zero files to edit.
There are two ways to set them:
# PowerShell, run once
[Environment]::SetEnvironmentVariable("VAR_NAME", "value", "User")Then restart OpenCode.
$env:VAR_NAME = "value"Then run opencode in the same terminal.
| Variable | Description |
|---|---|
BARK_DEVICE_KEY |
Your Bark device key (from step 2 above) |
| Variable | Default | Controls |
|---|---|---|
WATCH_BRIDGE_PERMISSION |
1 |
Permission request notifications |
WATCH_BRIDGE_IDLE |
1 |
Task completion notifications |
WATCH_BRIDGE_ERROR |
1 |
Error notifications |
| Variable | Default | Controls |
|---|---|---|
WATCH_BRIDGE_SOUND_PERMISSION |
alarm |
Sound for permission requests |
WATCH_BRIDGE_SOUND_IDLE |
bell |
Sound for task completion |
WATCH_BRIDGE_SOUND_ERROR |
alarm |
Sound for errors |
Available sounds: alarm, bell, birdsong, chime, crystal, news, note, update, or any iOS system sound name.
| Variable | Default | Description |
|---|---|---|
BARK_SERVER_URL |
https://api.day.app |
Self-hosted Bark server URL |
# Only get errors and permissions — mute "task complete"
[Environment]::SetEnvironmentVariable("WATCH_BRIDGE_IDLE", "0", "User")
# Permission = gentle chime, Error = loud alarm
[Environment]::SetEnvironmentVariable("WATCH_BRIDGE_SOUND_PERMISSION", "chime", "User")
[Environment]::SetEnvironmentVariable("WATCH_BRIDGE_SOUND_ERROR", "alarm", "User")
# Use your own Bark server
[Environment]::SetEnvironmentVariable("BARK_SERVER_URL", "https://mybark.com", "User")After any change, restart OpenCode.
watch-bridge/
├── src/
│ └── index.ts # OpenCode plugin (event hooks)
├── dashboard.ts # Web settings dashboard
├── package.json
├── tsconfig.json
├── LICENSE # MIT
└── README.md
MIT © CharlesMK16
{ "plugin": [ "D:/config/opencode/plugins/watch-bridge/src/index.ts" ] }