@gonzih/cc-discord 0.2.20 → 0.2.22

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/claude.js CHANGED
@@ -182,9 +182,12 @@ export function extractText(msg) {
182
182
  }
183
183
  /**
184
184
  * Resolve the claude CLI binary path.
185
- * Checks PATH entries + common npm global install locations.
185
+ * Checks CLAUDE_BIN env var first, then PATH entries + common npm global install locations.
186
186
  */
187
187
  function resolveClaude(pathEnv) {
188
+ // Allow test/operator override via CLAUDE_BIN
189
+ if (process.env.CLAUDE_BIN)
190
+ return process.env.CLAUDE_BIN;
188
191
  // Try PATH entries first
189
192
  const dirs = (pathEnv ?? process.env.PATH ?? "").split(":");
190
193
  for (const dir of dirs) {
@@ -92,8 +92,12 @@ export function injectMcp(ns, wsPath, token) {
92
92
  }
93
93
  /**
94
94
  * Resolve claude binary — same logic as claude.ts resolveClaude.
95
+ * Checks CLAUDE_BIN env var first, then PATH + common fallback locations.
95
96
  */
96
97
  function resolveClaude() {
98
+ // Allow test/operator override via CLAUDE_BIN
99
+ if (process.env.CLAUDE_BIN)
100
+ return process.env.CLAUDE_BIN;
97
101
  const dirs = (process.env.PATH ?? "").split(":");
98
102
  for (const dir of dirs) {
99
103
  const c = `${dir}/claude`;
package/dist/notifier.js CHANGED
@@ -83,6 +83,9 @@ function shortenModelName(model, driver) {
83
83
  * Appends " cost: $X.XXX" if a numeric cost field is present.
84
84
  */
85
85
  export function parseNotification(raw) {
86
+ // Filter cron-fire noise before any parsing — catches plain-text and JSON-wrapped ⏰ cron notifications
87
+ if (raw.startsWith("⏰") || raw.includes('"⏰'))
88
+ return null;
86
89
  let text = raw;
87
90
  let driver;
88
91
  let model;
@@ -109,10 +112,8 @@ export function parseNotification(raw) {
109
112
  isCron = parsed.is_cron;
110
113
  }
111
114
  catch {
112
- // non-JSON: fall through to text-based check below
115
+ // non-JSON: fall through
113
116
  }
114
- if (text.startsWith("⏰"))
115
- return null;
116
117
  // Parse eval_report if present — this field is non-standard and not in NotificationPayload type
117
118
  const evalReport = parseEvalReport(raw);
118
119
  if (!driver)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-discord",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Claude Code Discord bot — chat with Claude Code via Discord",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,8 @@
12
12
  "dev": "node --loader ts-node/esm src/index.ts",
13
13
  "test": "vitest run",
14
14
  "test:watch": "vitest",
15
- "test:coverage": "vitest run --coverage"
15
+ "test:coverage": "vitest run --coverage",
16
+ "test:integration": "CLAUDE_BIN=./test/fixtures/mock-claude.js vitest run test/integration/"
16
17
  },
17
18
  "files": [
18
19
  "dist/"