opencode-probleemwijken 1.5.0 → 1.7.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/dist/index.js CHANGED
@@ -6,6 +6,7 @@ var DEFAULT_CONFIG = {
6
6
  enabled: true,
7
7
  customSoundsDir: null,
8
8
  includeBundledSounds: true,
9
+ disabledSounds: [],
9
10
  notifications: {
10
11
  enabled: true,
11
12
  timeout: 5
@@ -57,6 +58,7 @@ function loadConfig() {
57
58
  enabled: userConfig.enabled ?? DEFAULT_CONFIG.enabled,
58
59
  customSoundsDir: userConfig.customSoundsDir ?? DEFAULT_CONFIG.customSoundsDir,
59
60
  includeBundledSounds: userConfig.includeBundledSounds ?? DEFAULT_CONFIG.includeBundledSounds,
61
+ disabledSounds: Array.isArray(userConfig.disabledSounds) ? userConfig.disabledSounds : DEFAULT_CONFIG.disabledSounds,
60
62
  notifications: {
61
63
  enabled: userConfig.notifications?.enabled ?? DEFAULT_CONFIG.notifications.enabled,
62
64
  timeout: userConfig.notifications?.timeout ?? DEFAULT_CONFIG.notifications.timeout
@@ -96,7 +98,7 @@ function getMessage(config, event) {
96
98
 
97
99
  // src/sound.ts
98
100
  import { platform } from "os";
99
- import { join as join2, dirname, extname } from "path";
101
+ import { join as join2, dirname, extname, basename, resolve } from "path";
100
102
  import { fileURLToPath } from "url";
101
103
  import { existsSync as existsSync2, readdirSync } from "fs";
102
104
  import { spawn } from "child_process";
@@ -128,6 +130,19 @@ function getSoundFilesFromDir(directory) {
128
130
  return [];
129
131
  }
130
132
  }
133
+ function isSoundDisabled(soundPath, disabledSounds) {
134
+ if (disabledSounds.length === 0)
135
+ return false;
136
+ const fileName = basename(soundPath);
137
+ const resolvedPath = resolve(soundPath);
138
+ return disabledSounds.some((disabled) => {
139
+ if (disabled === fileName)
140
+ return true;
141
+ if (resolve(disabled) === resolvedPath)
142
+ return true;
143
+ return false;
144
+ });
145
+ }
131
146
  function getAllSoundFiles(config) {
132
147
  const allSounds = [];
133
148
  if (config.includeBundledSounds) {
@@ -139,6 +154,9 @@ function getAllSoundFiles(config) {
139
154
  if (config.customSoundsDir && existsSync2(config.customSoundsDir)) {
140
155
  allSounds.push(...getSoundFilesFromDir(config.customSoundsDir));
141
156
  }
157
+ if (config.disabledSounds && config.disabledSounds.length > 0) {
158
+ return allSounds.filter((sound) => !isSoundDisabled(sound, config.disabledSounds));
159
+ }
142
160
  return allSounds;
143
161
  }
144
162
  function getRandomSound(sounds) {
@@ -148,7 +166,7 @@ function getRandomSound(sounds) {
148
166
  return sounds[index];
149
167
  }
150
168
  async function runCommand(command, args) {
151
- return new Promise((resolve, reject) => {
169
+ return new Promise((resolve2, reject) => {
152
170
  const proc = spawn(command, args, {
153
171
  stdio: "ignore",
154
172
  detached: false
@@ -158,7 +176,7 @@ async function runCommand(command, args) {
158
176
  });
159
177
  proc.on("close", (code) => {
160
178
  if (code === 0) {
161
- resolve();
179
+ resolve2();
162
180
  } else {
163
181
  reject(new Error(`Command exited with code ${code}`));
164
182
  }
@@ -238,7 +256,7 @@ async function playRandomSound(config) {
238
256
  import { platform as platform2 } from "os";
239
257
  import { spawn as spawn2 } from "child_process";
240
258
  async function runCommand2(command, args) {
241
- return new Promise((resolve, reject) => {
259
+ return new Promise((resolve2, reject) => {
242
260
  const proc = spawn2(command, args, {
243
261
  stdio: "ignore",
244
262
  detached: false
@@ -246,7 +264,7 @@ async function runCommand2(command, args) {
246
264
  proc.on("error", reject);
247
265
  proc.on("close", (code) => {
248
266
  if (code === 0)
249
- resolve();
267
+ resolve2();
250
268
  else
251
269
  reject(new Error(`Exit code ${code}`));
252
270
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-probleemwijken",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "OpenCode plugin that plays random Probleemwijken/Derkolk sounds and sends push notifications when a session completes",
5
5
  "author": "Daan-Friday",
6
6
  "license": "MIT",
@@ -33,7 +33,8 @@
33
33
  "notifications",
34
34
  "probleemwijken",
35
35
  "derkolk",
36
- "harrykoster"
36
+ "harrykoster",
37
+ "gen-z"
37
38
  ],
38
39
  "devDependencies": {
39
40
  "@opencode-ai/plugin": "^1.0.224",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file