@mohak34/opencode-notifier 0.1.22 → 0.1.24

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -1
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -3785,6 +3785,9 @@ var DEFAULT_CONFIG = {
3785
3785
  }
3786
3786
  };
3787
3787
  function getConfigPath() {
3788
+ if (process.env.OPENCODE_NOTIFIER_CONFIG_PATH) {
3789
+ return process.env.OPENCODE_NOTIFIER_CONFIG_PATH;
3790
+ }
3788
3791
  return join(homedir(), ".config", "opencode", "opencode-notifier.json");
3789
3792
  }
3790
3793
  function parseEventConfig(userEvent, defaultConfig) {
@@ -4308,10 +4311,11 @@ async function handleEventWithElapsedTime(client, config, eventType, projectName
4308
4311
  await handleEvent(config, eventType, projectName, elapsedSeconds, sessionTitle);
4309
4312
  }
4310
4313
  var NotifierPlugin = async ({ client, directory }) => {
4311
- const config = loadConfig();
4314
+ const getConfig = () => loadConfig();
4312
4315
  const projectName = directory ? basename(directory) : null;
4313
4316
  return {
4314
4317
  event: async ({ event }) => {
4318
+ const config = getConfig();
4315
4319
  if (event.type === "permission.updated") {
4316
4320
  await handleEventWithElapsedTime(client, config, "permission", projectName, event);
4317
4321
  }
@@ -4341,9 +4345,11 @@ var NotifierPlugin = async ({ client, directory }) => {
4341
4345
  }
4342
4346
  },
4343
4347
  "permission.ask": async () => {
4348
+ const config = getConfig();
4344
4349
  await handleEvent(config, "permission", projectName, null);
4345
4350
  },
4346
4351
  "tool.execute.before": async (input) => {
4352
+ const config = getConfig();
4347
4353
  if (input.tool === "question") {
4348
4354
  await handleEvent(config, "question", projectName, null);
4349
4355
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "OpenCode plugin that sends system notifications and plays sounds when permission is needed, generation completes, or errors occur",
5
5
  "author": "mohak34",
6
6
  "license": "MIT",
@@ -23,7 +23,8 @@
23
23
  "scripts": {
24
24
  "build": "bun build src/index.ts --outdir dist --target node",
25
25
  "prepublishOnly": "bun run build",
26
- "typecheck": "tsc --noEmit"
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "bun test"
27
28
  },
28
29
  "keywords": [
29
30
  "opencode",