Skip to content

Commit 9ca2cf4

Browse files
committed
feat: add desktop GUI app with one-click server and bot control
- Add customtkinter-based desktop GUI with setup wizard, dashboard, live logs, model picker, and session viewer - Default launch opens GUI; use 'opencode-telegram cli' for headless mode - Auto-start OpenCode server when bot starts (configurable) - Fix model switching using proper /config/providers API endpoint - Rewrite bot handler to match actual OpenCode server API paths - Add GitHub Actions workflows (CI + PyPI publish) - Update README with new GUI-first instructions
1 parent 097195f commit 9ca2cf4

4 files changed

Lines changed: 511 additions & 48 deletions

File tree

README.md

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
# OpenCode Telegram Bot
1+
# tp-opencode
22

33
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
55
[![OpenCode](https://img.shields.io/badge/OpenCode-Compatible-brightgreen)](https://opencode.ai)
66

7-
**OpenCode mobile client via Telegram** — run and monitor AI coding tasks from your phone while everything runs locally on your machine. A lightweight [OpenClaw](https://github.com/openclaw/openclaw) alternative built for [OpenCode](https://github.com/anomalyco/opencode).
8-
9-
[![OpenCode Telegram Bot](assets/banner.png)](https://opencode.ai)
7+
**Desktop GUI app for running OpenCode with a Telegram bot** — one click to start everything. A lightweight [OpenClaw](https://github.com/openclaw/openclaw) alternative built for [OpenCode](https://github.com/anomalyco/opencode).
108

119
## Features
1210

13-
- **Remote coding** — send prompts to OpenCode from anywhere, receive complete results with code sent as files
14-
- **Session management** — create, switch, rename, compact, and abort sessions from Telegram
15-
- **Live status** — pinned message with current project, model, context usage, updated in real time
16-
- **Model switching** — pick models directly in the chat via inline keyboard
17-
- **Agent modes** — switch between Plan and Build modes on the fly with `/mode`
18-
- **Interactive Q&A** — answer agent questions and approve permissions via inline buttons
19-
- **Voice prompts** — send voice messages, transcribe them via Whisper-compatible API
20-
- **File attachments** — send images, documents, and text-based files to OpenCode
11+
- **Desktop GUI** — one-window app with setup wizard, server control, bot control, live logs, and model picker
12+
- **One-command launch**`opencode-telegram` opens the GUI, auto-starts the server and bot
13+
- **Remote coding** — send prompts to OpenCode from Telegram, receive results on your phone
14+
- **Session management** — create, switch, rename, and abort sessions from Telegram or the GUI
15+
- **Model picker** — browse and switch models from the GUI dashboard
16+
- **Agent modes** — switch between Plan and Build modes with `/mode`
17+
- **Voice prompts** — send voice messages, transcribe via Whisper-compatible API
2118
- **Scheduled tasks** — schedule prompts to run later or on a recurring interval
22-
- **Server control** — start/stop the OpenCode server remotely via `/opencode_start` and `/opencode_stop`
23-
- **Web GUI** — built-in monitoring dashboard at `http://localhost:8765`
2419
- **Security** — strict user ID whitelist; no external attack surface
2520
- **Localization** — English, Deutsch, Español, Français, Русский, 简体中文
2621
- **Docker support** — one-command deployment with docker-compose
22+
- **CLI mode** — run headless with `opencode-telegram cli`
2723

2824
## Architecture
2925

@@ -65,44 +61,45 @@ Get your **Telegram User ID** by messaging [@userinfobot](https://t.me/userinfob
6561
### 2. Install OpenCode
6662

6763
```bash
68-
# Install OpenCode CLI
6964
curl -fsSL https://opencode.ai/install | bash
70-
71-
# Start the server in your project directory
72-
cd /path/to/project
73-
opencode serve
7465
```
7566

76-
### 3. Install & Run the Bot
77-
78-
#### Option A: pip install (recommended)
67+
### 3. Install & Launch the App
7968

8069
```bash
8170
pip install tp-opencode
82-
opencode-telegram config # Interactive setup wizard
83-
opencode-telegram start # Launch the bot
71+
opencode-telegram
8472
```
8573

86-
#### Option B: From source
74+
That's it. The GUI opens, you fill in your bot token and user ID on first launch, then click **Start Server** and **Start Bot**. Everything runs from one window.
75+
76+
#### From source
8777

8878
```bash
8979
git clone https://github.com/2241812/tp-opencode.git
9080
cd tp-opencode
91-
pip install -r requirements.txt
92-
opencode-telegram config # Interactive setup wizard
93-
opencode-telegram start # Launch the bot
81+
pip install -e .
82+
opencode-telegram
9483
```
9584

96-
#### Option C: Docker
85+
#### CLI mode (headless, no GUI)
9786

9887
```bash
99-
git clone https://github.com/2241812/tp-opencode.git
100-
cd tp-opencode
101-
cp .env.example .env
102-
# Edit .env with your bot token and user ID
103-
docker compose up -d
88+
opencode-telegram cli
10489
```
10590

91+
## Desktop GUI
92+
93+
The app opens a single window with everything you need:
94+
95+
- **Setup Wizard** — on first launch, enter your bot token, user ID, and OpenCode URL
96+
- **Dashboard** — server status, bot status, model info at a glance
97+
- **Start/Stop buttons** — one click to start the OpenCode server and the Telegram bot
98+
- **Live Logs** — real-time log output from the bot
99+
- **Model Picker** — browse available models from your OpenCode config and select one
100+
- **Session List** — see recent sessions
101+
- **Reconfigure** — go back to the setup wizard anytime
102+
106103
## Bot Commands
107104

108105
| Command | Description |
@@ -251,7 +248,8 @@ tp-opencode/
251248
│ ├── web/
252249
│ │ └── gui.py # Flask monitoring dashboard
253250
│ ├── locales/ # Translation files (en, ru, zh, de, es, fr)
254-
│ └── main.py # Entry point and CLI
251+
│ ├── gui.py # Desktop GUI app (customtkinter)
252+
│ └── main.py # Entry point (defaults to GUI, cli for headless)
255253
├── tests/
256254
├── Dockerfile
257255
├── docker-compose.yml

requirements.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
python-telegram-bot==21.3
2-
aiohttp==3.11.12
3-
pydantic==2.10.6
4-
pydantic-settings==2.7.1
5-
python-dotenv==1.0.1
6-
sseclient-py==1.8.0
7-
apscheduler==3.10.4
8-
flask==3.1.0
9-
openai==1.61.1
10-
httpx==0.28.1
11-
prompt-toolkit==3.0.50
12-
rich==13.9.4
1+
python-telegram-bot>=21.0
2+
aiohttp>=3.11
3+
pydantic>=2.10
4+
pydantic-settings>=2.7
5+
python-dotenv>=1.0
6+
sseclient-py>=1.8
7+
apscheduler>=3.10
8+
flask>=3.1
9+
openai>=1.60
10+
httpx>=0.28
11+
prompt-toolkit>=3.0
12+
rich>=13.9
13+
customtkinter>=5.2

0 commit comments

Comments
 (0)