@alexnodeland/claude-telegram 0.1.4 → 0.2.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 +15 -0
- package/README.md +46 -17
- package/package.json +4 -2
- package/scripts/daemon.sh +157 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ 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.2.0] - 2025-03-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **npm distribution** — install via `bun add -g @alexnodeland/claude-telegram`
|
|
13
|
+
- **Daemon script** — `claude-telegram-daemon install` sets up launchd (macOS) or systemd (Linux) automatically
|
|
14
|
+
- **CONTRIBUTING.md** — development setup, code style, testing, and PR guidelines
|
|
15
|
+
- **GitHub Release workflow** — tag-triggered CI, GitHub Release, and npm publish with provenance
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Quick start defaults to npm install instead of git clone
|
|
20
|
+
- Orchestrator and channel mode docs updated for npm install path
|
|
21
|
+
|
|
8
22
|
## [0.1.0] - 2025-03-22
|
|
9
23
|
|
|
10
24
|
### Added
|
|
@@ -23,4 +37,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
23
37
|
- **HTML formatting** — all output uses Telegram HTML parse mode for reliable rendering
|
|
24
38
|
- **Zero Telegram SDK** — all API calls use native `fetch`
|
|
25
39
|
|
|
40
|
+
[0.2.0]: https://github.com/alexnodeland/claude-telegram/releases/tag/v0.2.0
|
|
26
41
|
[0.1.0]: https://github.com/alexnodeland/claude-telegram/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Control Claude Code from Telegram — run tasks, review diffs, and ship code from your phone.**
|
|
6
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/@alexnodeland/claude-telegram)
|
|
7
8
|
[](https://github.com/alexnodeland/claude-telegram/releases)
|
|
8
9
|
[](https://github.com/alexnodeland/claude-telegram/actions/workflows/ci.yml)
|
|
9
10
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -54,19 +55,54 @@ Claude Telegram gives you full Claude Code access from any Telegram client — p
|
|
|
54
55
|
|
|
55
56
|
## Quick start
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
### Prerequisites
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
- [Bun](https://bun.sh) >= 1.1
|
|
61
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) >= 2.1
|
|
62
|
+
- A Telegram bot token (message [@BotFather](https://t.me/BotFather), send `/newbot`, copy the token)
|
|
63
|
+
|
|
64
|
+
### Install and run
|
|
60
65
|
|
|
61
66
|
```bash
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
# Install the package
|
|
68
|
+
bun add -g @alexnodeland/claude-telegram
|
|
69
|
+
|
|
70
|
+
# Set your bot token
|
|
65
71
|
export TELEGRAM_BOT_TOKEN=your_token_here
|
|
66
|
-
|
|
72
|
+
|
|
73
|
+
# Start the orchestrator
|
|
74
|
+
claude-telegram-orchestrator
|
|
67
75
|
```
|
|
68
76
|
|
|
69
|
-
|
|
77
|
+
Or run directly without installing:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
TELEGRAM_BOT_TOKEN=your_token_here bunx @alexnodeland/claude-telegram/src/orchestrator.ts
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Pair your Telegram account
|
|
84
|
+
|
|
85
|
+
1. Send `/start` to your bot in Telegram
|
|
86
|
+
2. An already-approved user sends `/approve <CODE>` with the 6-character pairing code
|
|
87
|
+
|
|
88
|
+
To pre-approve users on first run, set `TELEGRAM_ALLOWED_USERS` with comma-separated Telegram user IDs:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
TELEGRAM_ALLOWED_USERS=783772449 claude-telegram-orchestrator
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Running as a daemon
|
|
95
|
+
|
|
96
|
+
A built-in script sets up launchd (macOS) or systemd (Linux) automatically:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
claude-telegram-daemon install # install and start
|
|
100
|
+
claude-telegram-daemon status # check if running
|
|
101
|
+
claude-telegram-daemon logs # tail logs
|
|
102
|
+
claude-telegram-daemon uninstall # stop and remove
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Auto-restarts on crash and starts on login. See the [orchestrator docs](docs/orchestrator-mode.md#running-as-a-daemon) for manual setup options.
|
|
70
106
|
|
|
71
107
|
> [!TIP]
|
|
72
108
|
> The **orchestrator mode** above is standalone and manages its own Claude sessions. There's also a [channel mode](docs/channel-mode.md) that attaches Telegram to an existing Claude Code session as an MCP plugin.
|
|
@@ -173,18 +209,11 @@ Anything that isn't a command is sent as a prompt to Claude.
|
|
|
173
209
|
| [Channel Mode](docs/channel-mode.md) | MCP channel plugin setup, pairing, access commands, tools |
|
|
174
210
|
| [Architecture](docs/architecture.md) | System design, module map, security model, data flow |
|
|
175
211
|
| [Changelog](CHANGELOG.md) | Release history |
|
|
212
|
+
| [Contributing](CONTRIBUTING.md) | Development setup, code style, testing, pull requests |
|
|
176
213
|
|
|
177
|
-
##
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
just setup # Install deps + configure git hooks
|
|
181
|
-
just dev-orchestrator # Watch mode
|
|
182
|
-
just ci # Typecheck + lint + test (112 tests)
|
|
183
|
-
just fix # Auto-fix lint/format
|
|
184
|
-
just release 1.1.0 # Tag a release
|
|
185
|
-
```
|
|
214
|
+
## Contributing
|
|
186
215
|
|
|
187
|
-
See [
|
|
216
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
188
217
|
|
|
189
218
|
## License
|
|
190
219
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexnodeland/claude-telegram",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
9
|
"claude-telegram": "./src/index.ts",
|
|
10
|
-
"claude-telegram-orchestrator": "./src/orchestrator.ts"
|
|
10
|
+
"claude-telegram-orchestrator": "./src/orchestrator.ts",
|
|
11
|
+
"claude-telegram-daemon": "./scripts/daemon.sh"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"start": "bun run src/index.ts",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"files": [
|
|
38
39
|
"src/",
|
|
40
|
+
"scripts/",
|
|
39
41
|
"LICENSE",
|
|
40
42
|
"README.md",
|
|
41
43
|
"CHANGELOG.md"
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install/uninstall claude-telegram as a system daemon.
|
|
3
|
+
# Usage: daemon.sh install | uninstall | status | logs
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
# Resolve paths
|
|
7
|
+
BUN="$(which bun 2>/dev/null || echo "$HOME/.bun/bin/bun")"
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
9
|
+
ORCHESTRATOR="$SCRIPT_DIR/src/orchestrator.ts"
|
|
10
|
+
TOKEN="${TELEGRAM_BOT_TOKEN:-}"
|
|
11
|
+
|
|
12
|
+
if [ -z "$TOKEN" ] && [ "$1" != "uninstall" ] && [ "$1" != "status" ] && [ "$1" != "logs" ]; then
|
|
13
|
+
echo "Error: TELEGRAM_BOT_TOKEN is not set"
|
|
14
|
+
echo " export TELEGRAM_BOT_TOKEN=your_token_here"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# ── macOS (launchd) ─────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
PLIST="$HOME/Library/LaunchAgents/com.claude-telegram.plist"
|
|
21
|
+
|
|
22
|
+
install_launchd() {
|
|
23
|
+
cat > "$PLIST" << EOF
|
|
24
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
26
|
+
<plist version="1.0">
|
|
27
|
+
<dict>
|
|
28
|
+
<key>Label</key>
|
|
29
|
+
<string>com.claude-telegram</string>
|
|
30
|
+
<key>ProgramArguments</key>
|
|
31
|
+
<array>
|
|
32
|
+
<string>$BUN</string>
|
|
33
|
+
<string>run</string>
|
|
34
|
+
<string>$ORCHESTRATOR</string>
|
|
35
|
+
</array>
|
|
36
|
+
<key>EnvironmentVariables</key>
|
|
37
|
+
<dict>
|
|
38
|
+
<key>TELEGRAM_BOT_TOKEN</key>
|
|
39
|
+
<string>$TOKEN</string>
|
|
40
|
+
<key>PATH</key>
|
|
41
|
+
<string>/usr/local/bin:/usr/bin:/bin:$HOME/.bun/bin</string>
|
|
42
|
+
</dict>
|
|
43
|
+
<key>KeepAlive</key>
|
|
44
|
+
<true/>
|
|
45
|
+
<key>StandardOutPath</key>
|
|
46
|
+
<string>/tmp/claude-telegram.log</string>
|
|
47
|
+
<key>StandardErrorPath</key>
|
|
48
|
+
<string>/tmp/claude-telegram.log</string>
|
|
49
|
+
</dict>
|
|
50
|
+
</plist>
|
|
51
|
+
EOF
|
|
52
|
+
launchctl load "$PLIST"
|
|
53
|
+
echo "Daemon installed and started."
|
|
54
|
+
echo " Logs: tail -f /tmp/claude-telegram.log"
|
|
55
|
+
echo " Stop: $0 uninstall"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
uninstall_launchd() {
|
|
59
|
+
if [ -f "$PLIST" ]; then
|
|
60
|
+
launchctl unload "$PLIST" 2>/dev/null || true
|
|
61
|
+
rm -f "$PLIST"
|
|
62
|
+
echo "Daemon stopped and removed."
|
|
63
|
+
else
|
|
64
|
+
echo "No daemon installed."
|
|
65
|
+
fi
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
status_launchd() {
|
|
69
|
+
if launchctl list com.claude-telegram &>/dev/null; then
|
|
70
|
+
echo "Running"
|
|
71
|
+
launchctl list com.claude-telegram
|
|
72
|
+
else
|
|
73
|
+
echo "Not running"
|
|
74
|
+
fi
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
logs_launchd() {
|
|
78
|
+
tail -f /tmp/claude-telegram.log
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# ── Linux (systemd) ─────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
SERVICE_DIR="$HOME/.config/systemd/user"
|
|
84
|
+
SERVICE="$SERVICE_DIR/claude-telegram.service"
|
|
85
|
+
|
|
86
|
+
install_systemd() {
|
|
87
|
+
mkdir -p "$SERVICE_DIR"
|
|
88
|
+
cat > "$SERVICE" << EOF
|
|
89
|
+
[Unit]
|
|
90
|
+
Description=Claude Telegram Orchestrator
|
|
91
|
+
After=network.target
|
|
92
|
+
|
|
93
|
+
[Service]
|
|
94
|
+
ExecStart=$BUN run $ORCHESTRATOR
|
|
95
|
+
Environment=TELEGRAM_BOT_TOKEN=$TOKEN
|
|
96
|
+
Restart=on-failure
|
|
97
|
+
RestartSec=5
|
|
98
|
+
|
|
99
|
+
[Install]
|
|
100
|
+
WantedBy=default.target
|
|
101
|
+
EOF
|
|
102
|
+
systemctl --user daemon-reload
|
|
103
|
+
systemctl --user enable --now claude-telegram
|
|
104
|
+
echo "Daemon installed and started."
|
|
105
|
+
echo " Logs: journalctl --user -u claude-telegram -f"
|
|
106
|
+
echo " Stop: $0 uninstall"
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
uninstall_systemd() {
|
|
110
|
+
if [ -f "$SERVICE" ]; then
|
|
111
|
+
systemctl --user disable --now claude-telegram 2>/dev/null || true
|
|
112
|
+
rm -f "$SERVICE"
|
|
113
|
+
systemctl --user daemon-reload
|
|
114
|
+
echo "Daemon stopped and removed."
|
|
115
|
+
else
|
|
116
|
+
echo "No daemon installed."
|
|
117
|
+
fi
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
status_systemd() {
|
|
121
|
+
systemctl --user status claude-telegram 2>/dev/null || echo "Not running"
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
logs_systemd() {
|
|
125
|
+
journalctl --user -u claude-telegram -f
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# ── Dispatch ─────────────────────────────────────────────────────────────────
|
|
129
|
+
|
|
130
|
+
ACTION="${1:-install}"
|
|
131
|
+
OS="$(uname -s)"
|
|
132
|
+
|
|
133
|
+
case "$OS" in
|
|
134
|
+
Darwin)
|
|
135
|
+
case "$ACTION" in
|
|
136
|
+
install) install_launchd ;;
|
|
137
|
+
uninstall) uninstall_launchd ;;
|
|
138
|
+
status) status_launchd ;;
|
|
139
|
+
logs) logs_launchd ;;
|
|
140
|
+
*) echo "Usage: $0 install|uninstall|status|logs"; exit 1 ;;
|
|
141
|
+
esac
|
|
142
|
+
;;
|
|
143
|
+
Linux)
|
|
144
|
+
case "$ACTION" in
|
|
145
|
+
install) install_systemd ;;
|
|
146
|
+
uninstall) uninstall_systemd ;;
|
|
147
|
+
status) status_systemd ;;
|
|
148
|
+
logs) logs_systemd ;;
|
|
149
|
+
*) echo "Usage: $0 install|uninstall|status|logs"; exit 1 ;;
|
|
150
|
+
esac
|
|
151
|
+
;;
|
|
152
|
+
*)
|
|
153
|
+
echo "Unsupported OS: $OS"
|
|
154
|
+
echo "Use tmux instead: tmux new-session -d -s claude 'claude-telegram-orchestrator'"
|
|
155
|
+
exit 1
|
|
156
|
+
;;
|
|
157
|
+
esac
|