@alexnodeland/claude-telegram 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] - 2026-03-22
9
+
10
+ ### Added
11
+
12
+ - **Project MCP server loading** — orchestrator reads the target directory's `.mcp.json` and merges project MCP servers into spawned Claude CLI sessions. Projects with MCP servers (e.g., Slack, Jira, Confluence) now work out of the box via `/new`.
13
+ - **Explicit setting sources** — passes `--setting-sources user,project,local` to ensure project hooks and permissions are loaded in `-p` mode.
14
+ - **PATH augmentation** — spawned Claude CLI processes include `/opt/homebrew/bin` in PATH, fixing MCP server startup failures when running as a launchd daemon with a restricted PATH.
15
+
16
+ ## [0.2.1] - 2026-03-22
17
+
18
+ ### Fixed
19
+
20
+ - **`claude` not found in daemon** — orchestrator now reads `CLAUDE_BIN` env var for the CLI path, falling back to `"claude"` from `$PATH`. Fixes "Executable not found" when launchd/systemd don't inherit the user's full `$PATH`.
21
+ - Daemon install script (`daemon.sh`) auto-detects the `claude` binary path and passes `CLAUDE_BIN` into the launchd plist / systemd unit.
22
+
8
23
  ## [0.2.0] - 2025-03-22
9
24
 
10
25
  ### Added
@@ -37,5 +52,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
37
52
  - **HTML formatting** — all output uses Telegram HTML parse mode for reliable rendering
38
53
  - **Zero Telegram SDK** — all API calls use native `fetch`
39
54
 
55
+ [0.2.1]: https://github.com/alexnodeland/claude-telegram/releases/tag/v0.2.1
40
56
  [0.2.0]: https://github.com/alexnodeland/claude-telegram/releases/tag/v0.2.0
41
57
  [0.1.0]: https://github.com/alexnodeland/claude-telegram/releases/tag/v0.1.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexnodeland/claude-telegram",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Claude Code Channel plugin + standalone orchestrator bridging Telegram to Claude Code sessions",
5
5
  "module": "src/index.ts",
6
6
  "main": "src/index.ts",
package/scripts/daemon.sh CHANGED
@@ -8,6 +8,7 @@ BUN="$(which bun 2>/dev/null || echo "$HOME/.bun/bin/bun")"
8
8
  SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
9
9
  ORCHESTRATOR="$SCRIPT_DIR/src/orchestrator.ts"
10
10
  TOKEN="${TELEGRAM_BOT_TOKEN:-}"
11
+ CLAUDE_BIN="${CLAUDE_BIN:-$(which claude 2>/dev/null || echo "claude")}"
11
12
 
12
13
  if [ -z "$TOKEN" ] && [ "$1" != "uninstall" ] && [ "$1" != "status" ] && [ "$1" != "logs" ]; then
13
14
  echo "Error: TELEGRAM_BOT_TOKEN is not set"
@@ -37,6 +38,8 @@ install_launchd() {
37
38
  <dict>
38
39
  <key>TELEGRAM_BOT_TOKEN</key>
39
40
  <string>$TOKEN</string>
41
+ <key>CLAUDE_BIN</key>
42
+ <string>$CLAUDE_BIN</string>
40
43
  <key>PATH</key>
41
44
  <string>/usr/local/bin:/usr/bin:/bin:$HOME/.bun/bin</string>
42
45
  </dict>
@@ -93,6 +96,7 @@ After=network.target
93
96
  [Service]
94
97
  ExecStart=$BUN run $ORCHESTRATOR
95
98
  Environment=TELEGRAM_BOT_TOKEN=$TOKEN
99
+ Environment=CLAUDE_BIN=$CLAUDE_BIN
96
100
  Restart=on-failure
97
101
  RestartSec=5
98
102
 
@@ -348,6 +348,7 @@ const MAX_TURNS = Number(process.env.ORCHESTRATOR_MAX_TURNS ?? "50");
348
348
  let globalModel = process.env.ORCHESTRATOR_MODEL;
349
349
 
350
350
  // Absolute path to the sidecar script
351
+ const CLAUDE_BIN = process.env.CLAUDE_BIN ?? "claude";
351
352
  const RELAY_SCRIPT = resolve(import.meta.dir, "permission-relay.ts");
352
353
 
353
354
  process.stderr.write(
@@ -1241,10 +1242,26 @@ async function runQuery(
1241
1242
  const isResume = session.sessionId !== "pending";
1242
1243
  const model = session.model ?? globalModel;
1243
1244
 
1244
- // Write temp MCP config for the permission relay sidecar
1245
+ // Read project .mcp.json so spawned sessions get the project's MCP servers.
1246
+ // In -p mode the workspace trust dialog is skipped, which may prevent
1247
+ // .mcp.json servers from being auto-enabled. Merging them here is defensive.
1248
+ let projectMcpServers: Record<string, unknown> = {};
1249
+ try {
1250
+ const raw = await readFile(join(session.cwd, ".mcp.json"), "utf8");
1251
+ const parsed = JSON.parse(raw);
1252
+ if (parsed?.mcpServers && typeof parsed.mcpServers === "object") {
1253
+ projectMcpServers = parsed.mcpServers;
1254
+ }
1255
+ } catch {
1256
+ // No .mcp.json or invalid — fine, not every project has one
1257
+ }
1258
+
1259
+ // Write temp MCP config: project servers + permission relay sidecar.
1260
+ // Relay is spread last so a project can't shadow it.
1245
1261
  const mcpConfigPath = `/tmp/telegram-relay-${chatId}-${process.pid}.json`;
1246
1262
  const mcpConfig = {
1247
1263
  mcpServers: {
1264
+ ...projectMcpServers,
1248
1265
  telegram_relay: {
1249
1266
  command: "bun",
1250
1267
  args: ["run", RELAY_SCRIPT],
@@ -1258,13 +1275,15 @@ async function runQuery(
1258
1275
  await writeFile(mcpConfigPath, JSON.stringify(mcpConfig));
1259
1276
 
1260
1277
  const args = [
1261
- "claude",
1278
+ CLAUDE_BIN,
1262
1279
  "-p",
1263
1280
  "--output-format",
1264
1281
  "stream-json",
1265
1282
  "--verbose",
1266
1283
  "--max-turns",
1267
1284
  String(MAX_TURNS),
1285
+ "--setting-sources",
1286
+ "user,project,local",
1268
1287
  "--mcp-config",
1269
1288
  mcpConfigPath,
1270
1289
  "--permission-prompt-tool",
@@ -1294,11 +1313,16 @@ async function runQuery(
1294
1313
  ` prompt: ${prompt.slice(0, 80)}${prompt.length > 80 ? "…" : ""}\n`,
1295
1314
  );
1296
1315
 
1316
+ // Ensure homebrew/nvm paths are available — the launchd plist PATH is minimal
1317
+ const extraPaths = ["/opt/homebrew/bin", "/opt/homebrew/sbin", "/usr/local/bin"];
1318
+ const currentPath = process.env.PATH ?? "";
1319
+ const mergedPath = [...extraPaths.filter((p) => !currentPath.includes(p)), currentPath].join(":");
1320
+
1297
1321
  const proc = Bun.spawn(args, {
1298
1322
  cwd: session.cwd,
1299
1323
  stdout: "pipe",
1300
1324
  stderr: "pipe",
1301
- env: { ...process.env },
1325
+ env: { ...process.env, PATH: mergedPath },
1302
1326
  });
1303
1327
 
1304
1328
  activeProcs.set(chatId, proc);