opencode-discord-notify 0.4.0 → 0.5.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/README-JP.md CHANGED
@@ -10,11 +10,9 @@
10
10
 
11
11
  [English](README.md) | 日本語
12
12
 
13
- <!-- markdownlint-disable -->
14
13
  <p align="center">
15
14
  <img src="assets/image/sample-forum-ch.png" width="700" alt="Discord Forum channel example" />
16
15
  </p>
17
- <!-- markdownlint-enable -->
18
16
 
19
17
  OpenCode のイベントを Discord Webhook に通知するプラグインです。
20
18
  Discord の Forum チャンネル webhook を前提に、セッション開始時(または最初の通知タイミング)にスレッド(投稿)を作成して、その後の更新を同スレッドに流します。
@@ -63,7 +61,11 @@ OpenCode を再起動してください。
63
61
  - `DISCORD_WEBHOOK_PERMISSION_MENTION`: `permission.updated` の通知本文に付けるメンション(`DISCORD_WEBHOOK_COMPLETE_MENTION` へのフォールバックなし。`@everyone` または `@here` のみ許容。Forum webhook の仕様上、ping は常に発生しない)
64
62
  - `DISCORD_WEBHOOK_EXCLUDE_INPUT_CONTEXT`: `1` のとき input context(`<file>` から始まる user `text` part)を通知しない(デフォルト: `1` / `0` で無効化)
65
63
  - `DISCORD_WEBHOOK_SHOW_ERROR_ALERT`: `1` のとき Discord webhook の送信が失敗した場合に OpenCode TUI のトーストを表示します(429 含む)(デフォルト: `1` / `0` で無効化)
66
- - `DISCORD_SEND_PARAMS`: embed の fields として送るキーをカンマ区切りで指定。指定可能キー: `sessionID`, `permissionID`, `type`, `pattern`, `messageID`, `callID`, `partID`, `role`, `directory`, `projectID`。未設定・空文字・空要素のみの場合は全て選択。`session.created` は `DISCORD_SEND_PARAMS` に関わらず `sessionID`, `projectID`, `directory` を必ず含みます。
64
+ - `DISCORD_SEND_PARAMS`: embed の fields として送るキーをカンマ区切りで指定。
65
+ - **指定可能キー**: `sessionID`, `permissionID`, `type`, `pattern`, `messageID`, `callID`, `partID`, `role`, `directory`, `projectID`
66
+ - **デフォルト動作**(未設定・空文字): 全て無効化(何も送信しない)
67
+ - **全て送信したい場合**: 全キーを列挙してください
68
+ - **注意**: `session.created` は `DISCORD_SEND_PARAMS` に関わらず `sessionID`, `projectID`, `directory` を必ず含みます
67
69
 
68
70
  ## 仕様メモ
69
71
 
package/README.md CHANGED
@@ -10,11 +10,9 @@
10
10
 
11
11
  English | [日本語](README-JP.md)
12
12
 
13
- <!-- markdownlint-disable -->
14
13
  <p align="center">
15
14
  <img src="assets/image/sample-forum-ch.png" width="700" alt="Discord Forum channel example" />
16
15
  </p>
17
- <!-- markdownlint-enable -->
18
16
 
19
17
  A plugin that posts OpenCode events to a Discord webhook.
20
18
 
@@ -65,7 +63,11 @@ Optional:
65
63
  - `DISCORD_WEBHOOK_PERMISSION_MENTION`: mention to put in `permission.updated` messages (no fallback to `DISCORD_WEBHOOK_COMPLETE_MENTION`; only `@everyone` or `@here` supported; Forum webhooks may not actually ping due to Discord behavior)
66
64
  - `DISCORD_WEBHOOK_EXCLUDE_INPUT_CONTEXT`: when set to `1`, exclude "input context" (user `text` parts that start with `<file>`) from notifications (default: `1`; set to `0` to disable)
67
65
  - `DISCORD_WEBHOOK_SHOW_ERROR_ALERT`: when set to `1`, show an OpenCode TUI toast when Discord webhook requests fail (includes 429). (default: `1`; set to `0` to disable)
68
- - `DISCORD_SEND_PARAMS`: comma-separated list of keys to include as embed fields. Allowed keys: `sessionID`, `permissionID`, `type`, `pattern`, `messageID`, `callID`, `partID`, `role`, `directory`, `projectID`. If unset, empty, or containing only empty elements, all keys are selected. `session.created` always includes `sessionID`, `projectID`, `directory` regardless.
66
+ - `DISCORD_SEND_PARAMS`: comma-separated list of keys to include as embed fields.
67
+ - **Allowed keys**: `sessionID`, `permissionID`, `type`, `pattern`, `messageID`, `callID`, `partID`, `role`, `directory`, `projectID`
68
+ - **Default behavior** (unset/empty): all fields are disabled (nothing sent)
69
+ - **To send all fields**: list all keys explicitly
70
+ - **Note**: `session.created` always includes `sessionID`, `projectID`, `directory` regardless
69
71
 
70
72
  ## Notes / behavior
71
73
 
package/dist/index.js CHANGED
@@ -85,9 +85,9 @@ function getEnv(name) {
85
85
  }
86
86
  }
87
87
  function parseSendParams(raw) {
88
- if (raw === void 0) return new Set(SEND_PARAM_KEYS);
88
+ if (raw === void 0) return /* @__PURE__ */ new Set();
89
89
  const tokens = raw.split(",").map((v) => v.trim()).filter(Boolean);
90
- if (!tokens.length) return new Set(SEND_PARAM_KEYS);
90
+ if (!tokens.length) return /* @__PURE__ */ new Set();
91
91
  const result = /* @__PURE__ */ new Set();
92
92
  for (const token of tokens) {
93
93
  if (!SEND_PARAM_KEY_SET.has(token)) continue;
@@ -690,6 +690,7 @@ plugin.__test__ = {
690
690
  buildFields,
691
691
  toIsoTimestamp,
692
692
  postDiscordWebhook,
693
+ parseSendParams,
693
694
  getTodoStatusMarker
694
695
  };
695
696
  var index_default = plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-discord-notify",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A plugin that posts OpenCode events to a Discord webhook.",
5
5
  "license": "MIT",
6
6
  "type": "module",