@pranjalmandavkar/opencode-notifier 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pranjal Mandavkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # OpenCode Notifier
2
+
3
+ OpenCode plugin that plays sounds and sends system notifications when session needs permission, is complete, encounters an error or question tool is invoked. Works on Linux, Windows and macOS(probably).
4
+
5
+ ## Installation
6
+
7
+ Add the plugin to your `opencode.json` or `opencode.jsonc`:
8
+ ```json
9
+ {
10
+ "plugins": [ "@pranjalmandavkar/opencode-notifier@latest" ]
11
+ }
12
+ ```
13
+
14
+ Using `@latest` ensures you always get the newest version of the plugin when the cache is refreshed
15
+
16
+ Restart OpenCode. The plugin will be automatically installed and loaded.
17
+
18
+ ## Updating
19
+
20
+ OpenCode caches plugins in `~/.cache/opencode`. Plugins are not auto-updated; you need to clear the cache to get new versions.
21
+
22
+ ### If you use `@latest`
23
+
24
+ Clear the cache and restart OpenCode.
25
+
26
+ **Linux/macOS:**
27
+
28
+ ```bash
29
+ rm -rf ~/.cache/opencode/node_modules/@mohak34/opencode-notifier
30
+ ```
31
+
32
+
33
+ **Windows (PowerShell):**
34
+
35
+ ```powershell
36
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\node_modules\@mohak34\opencode-notifier"
37
+ ```
38
+
39
+ Then restart OpenCode - it will download the latest version automatically.
40
+
41
+
42
+ ## Platform Notes
43
+
44
+ The plugin works out of the box on all platforms. For best results:
45
+
46
+ - **macOS**: No additional setup required
47
+ - **Windows**: No additional setup required
48
+ - **Linux**: For sounds, one of these should be installed: `paplay`, `aplay`, `mpv`, or `ffplay`. For notifications, `notify-send` is recommended.
49
+
50
+
51
+ ## Configuration
52
+
53
+ To customize the plugin, create `~/.config/opencode/opencode-notifier.json`:
54
+
55
+ ```json
56
+ {
57
+ "sound": true,
58
+ "notification": true,
59
+ "timeout": 5,
60
+ "showProjectName": true,
61
+ "events": {
62
+ "permission": { "sound": true, "notification": true },
63
+ "complete": { "sound": true, "notification": true },
64
+ "error": { "sound": true, "notification": true },
65
+ "question": { "sound": true, "notification": true }
66
+ },
67
+ "messages": {
68
+ "permission": "Session needs permission",
69
+ "complete": "Session has finished",
70
+ "error": "Session encountered an error",
71
+ "question": "Session has a question"
72
+ },
73
+ "sounds": {
74
+ "permission": "/path/to/custom/sound.wav",
75
+ "complete": "/path/to/custom/sound.wav",
76
+ "error": "/path/to/custom/sound.wav",
77
+ "question": "/path/to/custom/sound.wav"
78
+ }
79
+ }
80
+ ```
81
+
82
+ ### Options
83
+
84
+ | Option | Type | Default | Description |
85
+ |--------|------|---------|-------------|
86
+ | `sound` | boolean | `true` | Global toggle for all sounds |
87
+ | `notification` | boolean | `true` | Global toggle for all notifications |
88
+ | `timeout` | number | `5` | Notification duration in seconds (Linux only) |
89
+ | `showProjectName` | boolean | `true` | Show project folder name in notification title |
90
+
91
+ ### Events
92
+
93
+ Control sound and notification separately for each event:
94
+
95
+ ```json
96
+ {
97
+ "events": {
98
+ "permission": { "sound": true, "notification": true },
99
+ "complete": { "sound": false, "notification": true },
100
+ "error": { "sound": true, "notification": false },
101
+ "question": { "sound": true, "notification": true }
102
+ }
103
+ }
104
+ ```
105
+
106
+ Or use a boolean to toggle both:
107
+
108
+ ```json
109
+ {
110
+ "events": {
111
+ "permission": true,
112
+ "complete": false,
113
+ "error": true,
114
+ "question": true
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### Messages
120
+
121
+ Customize notification text:
122
+
123
+ ```json
124
+ {
125
+ "messages": {
126
+ "permission": "Action required",
127
+ "complete": "Done!",
128
+ "error": "Something went wrong",
129
+ "question": "Input needed"
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### Custom Sounds
135
+
136
+ Use your own sound files:
137
+
138
+ ```json
139
+ {
140
+ "sounds": {
141
+ "permission": "/home/user/sounds/alert.wav",
142
+ "complete": "/home/user/sounds/done.wav",
143
+ "error": "/home/user/sounds/error.wav",
144
+ "question": "/home/user/sounds/question.wav"
145
+ }
146
+ }
147
+ ```
148
+
149
+ If a custom sound file path is provided but the file doesn't exist, the plugin will fall back to the bundled sound.
package/bun.lock ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "configVersion": 1,
4
+ "workspaces": {
5
+ "": {
6
+ "name": "@pranjalmandavkar/opencode-notifier",
7
+ "dependencies": {
8
+ "node-notifier": "^10.0.1",
9
+ },
10
+ "devDependencies": {
11
+ "@opencode-ai/plugin": "^1.1.25",
12
+ "@types/bun": "latest",
13
+ "@types/node": "^25.0.9",
14
+ "@types/node-notifier": "^8.0.5",
15
+ },
16
+ "peerDependencies": {
17
+ "@opencode-ai/plugin": "^1.1.25",
18
+ },
19
+ },
20
+ },
21
+ "packages": {
22
+ "@opencode-ai/plugin": ["@opencode-ai/plugin@1.1.25", "", { "dependencies": { "@opencode-ai/sdk": "1.1.25", "zod": "4.1.8" } }, "sha512-oTUWS446H/j7z3pdzo3cOrB5N87XZ/RKdgPD8yHv/rLX92B4YQHjOqggVQ56Q+1VEnN0jxzhoqRylv/0ZEts/Q=="],
23
+
24
+ "@opencode-ai/sdk": ["@opencode-ai/sdk@1.1.25", "", {}, "sha512-mWUX489ArEF2ICg3iZsx2VQaGS3Z2j/dwAJDacao9t7dGDzjOIaacPw2weZ10zld7XmT9V9C0PM/A5lDZ52J+w=="],
25
+
26
+ "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
27
+
28
+ "@types/node": ["@types/node@25.0.9", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw=="],
29
+
30
+ "@types/node-notifier": ["@types/node-notifier@8.0.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-LX7+8MtTsv6szumAp6WOy87nqMEdGhhry/Qfprjm1Ma6REjVzeF7SCyvPtp5RaF6IkXCS9V4ra8g5fwvf2ZAYg=="],
31
+
32
+ "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
33
+
34
+ "growly": ["growly@1.3.0", "", {}, "sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw=="],
35
+
36
+ "is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="],
37
+
38
+ "is-wsl": ["is-wsl@2.2.0", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
39
+
40
+ "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
41
+
42
+ "node-notifier": ["node-notifier@10.0.1", "", { "dependencies": { "growly": "^1.3.0", "is-wsl": "^2.2.0", "semver": "^7.3.5", "shellwords": "^0.1.1", "uuid": "^8.3.2", "which": "^2.0.2" } }, "sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ=="],
43
+
44
+ "semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],
45
+
46
+ "shellwords": ["shellwords@0.1.1", "", {}, "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww=="],
47
+
48
+ "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
49
+
50
+ "uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="],
51
+
52
+ "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
53
+
54
+ "zod": ["zod@4.1.8", "", {}, "sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ=="],
55
+ }
56
+ }