@mohak34/opencode-notifier 0.1.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 Mohak S
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,118 @@
1
+ # @mohak34/opencode-notifier
2
+
3
+ OpenCode plugin that plays sounds and sends system notifications when permission is needed, generation completes, or errors occur. Works on macOS, Linux, and Windows.
4
+
5
+ ## Installation
6
+
7
+ Add the plugin to your `opencode.json` or `opencode.jsonc`:
8
+
9
+ ```json
10
+ {
11
+ "plugin": ["@mohak34/opencode-notifier"]
12
+ }
13
+ ```
14
+
15
+ Restart OpenCode. The plugin will be automatically installed and loaded.
16
+
17
+ ## Platform Notes
18
+
19
+ The plugin works out of the box on all platforms. For best results:
20
+
21
+ - **macOS**: No additional setup required
22
+ - **Windows**: No additional setup required
23
+ - **Linux**: For sounds, one of these should be installed: `paplay`, `aplay`, `mpv`, or `ffplay`. For notifications, `notify-send` is recommended.
24
+
25
+ ## Configuration
26
+
27
+ To customize the plugin, create `~/.config/opencode/opencode-notifier.json`:
28
+
29
+ ```json
30
+ {
31
+ "sound": true,
32
+ "notification": true,
33
+ "timeout": 5,
34
+ "events": {
35
+ "permission": { "sound": true, "notification": true },
36
+ "complete": { "sound": true, "notification": true },
37
+ "error": { "sound": true, "notification": true }
38
+ },
39
+ "messages": {
40
+ "permission": "OpenCode needs permission",
41
+ "complete": "OpenCode has finished",
42
+ "error": "OpenCode encountered an error"
43
+ },
44
+ "sounds": {
45
+ "permission": "/path/to/custom/sound.wav",
46
+ "complete": "/path/to/custom/sound.wav",
47
+ "error": "/path/to/custom/sound.wav"
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Options
53
+
54
+ | Option | Type | Default | Description |
55
+ |--------|------|---------|-------------|
56
+ | `sound` | boolean | `true` | Global toggle for all sounds |
57
+ | `notification` | boolean | `true` | Global toggle for all notifications |
58
+ | `timeout` | number | `5` | Notification duration in seconds (Linux only) |
59
+
60
+ ### Events
61
+
62
+ Control sound and notification separately for each event:
63
+
64
+ ```json
65
+ {
66
+ "events": {
67
+ "permission": { "sound": true, "notification": true },
68
+ "complete": { "sound": false, "notification": true },
69
+ "error": { "sound": true, "notification": false }
70
+ }
71
+ }
72
+ ```
73
+
74
+ Or use a boolean to toggle both:
75
+
76
+ ```json
77
+ {
78
+ "events": {
79
+ "permission": true,
80
+ "complete": false,
81
+ "error": true
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### Messages
87
+
88
+ Customize notification text:
89
+
90
+ ```json
91
+ {
92
+ "messages": {
93
+ "permission": "Action required",
94
+ "complete": "Done!",
95
+ "error": "Something went wrong"
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Custom Sounds
101
+
102
+ Use your own sound files:
103
+
104
+ ```json
105
+ {
106
+ "sounds": {
107
+ "permission": "/home/user/sounds/alert.wav",
108
+ "complete": "/home/user/sounds/done.wav",
109
+ "error": "/home/user/sounds/error.wav"
110
+ }
111
+ }
112
+ ```
113
+
114
+ If a custom sound file path is provided but the file doesn't exist, the plugin will fall back to the bundled sound.
115
+
116
+ ## License
117
+
118
+ MIT