@wirecat/tg-cli 0.48.0 → 0.49.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.md CHANGED
@@ -1,530 +1,414 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/WireCatLabs/tg-cli/main/docs/design/logo_text.png" alt="Tg CLI" width="480">
2
+ <img src="https://raw.githubusercontent.com/WireCatLabs/tg-cli/main/docs/images/social-preview.png" alt="Telegram CLI for AI agents" width="100%">
3
3
  </p>
4
4
 
5
- # tg-cli
5
+ # tg — Telegram CLI for AI agents
6
6
 
7
- A Telegram client for the terminal and for AI agents. `tg` is a command line tool and an MCP server
8
- for your own Telegram account: read your chats, find what was said, and answer — yourself, or
9
- through Claude, Codex, Cursor and other agents, within limits you set. In the groups you run, see
10
- which questions nobody answered and who joined.
11
-
12
- It runs on Windows, macOS and Linux. Documentation: [wirecat.dev/en/docs/tg](https://wirecat.dev/en/docs/tg).
13
-
14
- ```sh
15
- tg inbox # other people's unread messages, in every chat
16
- tg messages send "Book club" "Running 15 minutes late"
17
- ```
7
+ <p align="center">
8
+ Your whole Telegram account in the terminal, searchable on your computer, and ready for Claude Code,
9
+ Codex, Cursor or any agent — within limits you set.
10
+ </p>
18
11
 
19
- [![npm](https://img.shields.io/npm/v/@wirecat/tg-cli)](https://www.npmjs.com/package/@wirecat/tg-cli)
20
- [![CI](https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml)
21
- [![Node](https://img.shields.io/node/v/@wirecat/tg-cli)](https://nodejs.org/)
22
- [![Bun](https://img.shields.io/badge/bun-tested-f9f1e1)](https://bun.sh/)
23
- [![npm downloads](https://img.shields.io/npm/dm/@wirecat/tg-cli)](https://www.npmjs.com/package/@wirecat/tg-cli)
24
- [![License: Apache 2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
12
+ <p align="center">
13
+ <a href="https://wirecat.dev/en/docs/tg">Docs</a> ·
14
+ <a href="https://github.com/WireCatLabs/tg-cli/blob/main/docs/recipes.md">Examples</a> ·
15
+ <a href="https://wirecat.dev">WireCat</a>
16
+ </p>
25
17
 
26
- ## The bot
18
+ <p align="center">
19
+ <a href="https://www.npmjs.com/package/@wirecat/tg-cli"><img src="https://img.shields.io/npm/v/@wirecat/tg-cli" alt="npm"></a>
20
+ <a href="https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml"><img src="https://github.com/WireCatLabs/tg-cli/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
21
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/node/v/@wirecat/tg-cli" alt="Node"></a>
22
+ <a href="https://bun.sh/"><img src="https://img.shields.io/badge/bun-tested-f9f1e1" alt="Bun"></a>
23
+ <a href="https://www.npmjs.com/package/@wirecat/tg-cli"><img src="https://img.shields.io/npm/dm/@wirecat/tg-cli" alt="npm downloads"></a>
24
+ <a href="https://github.com/WireCatLabs/tg-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License: Apache 2.0"></a>
25
+ </p>
27
26
 
28
- `tg bot` works with a bot through Telegram's **official** [Bot API](https://core.telegram.org/bots/api)
29
- and its token from [@BotFather](https://t.me/BotFather). You can keep several bots: each is kept
30
- under a name you choose, and that name is the first word of the command.
27
+ <!-- HERO DEMO SLOT: replace the example below with a 30–45 s recording (GIF or video) of an agent
28
+ answering a question with source references. Record on a demo account whose chats hold only
29
+ invented people (Alice Example, Bob Sample), never a real account: this repository is public.
30
+ Use an absolute raw.githubusercontent.com URL so npmjs.com renders it too. -->
31
31
 
32
- **The entire Bot API.** All 185 methods of Telegram Bot API 10.3 are exposed through
33
- `tg <bot> bot api <method>`, including operations beyond the convenient message and chat
34
- commands. Use native field flags or JSON bodies for your own scripts and automation.
35
- [Bot API guide](docs/bot.md#the-complete-bot-api) · [Every command and option](docs/commands.md).
32
+ An example conversation (invented people, illustrative output):
36
33
 
37
- ```sh
38
- tg sales bot auth set # the token, at a hidden prompt; Telegram checks it first
39
- tg sales bot auth show # which bot it is
40
- tg sales bot recipients add user:<id> # the bot may write only here
41
- tg sales bot messages send "Team" "Build is ready" --file report.pdf
42
- tg bot list --check # every bot on this computer
34
+ ```text
35
+ You: Use tg CLI. What did I promise anyone in the last three days?
36
+ Agent: (runs tg review --since-time 3d: 12 chats)
37
+ I owe
38
+ · Alice Example — the invoice by Friday. "Alice Example", 24.09
39
+ Waiting on others
40
+ · Bob Sample — the mock-up by 25.09. Not in "Design" yet
41
+ You: Remind Bob about the mock-up.
42
+ Agent: Draft: "Hi Bob, how is the mock-up going?" Send it?
43
+ You: Yes.
43
44
  ```
44
45
 
45
- - **Every Bot API method.** `tg sales bot api --help` lists the complete native API;
46
- each method's help lists its fields. The usual bot commands remain available alongside it.
47
- - **One token per name, in the keyring.** `bot:<name>`, apart from your own login; `TG_BOT_TOKEN`
48
- for CI. The token is never printed — not in an error, not with `--trace`, not in a run record.
49
- - **Recipients and a journal.** Each bot has its own list of chats it may write to, and a journal
50
- of what it did, without the text.
51
- - **Messages and chats.** Send, edit, delete and pin, to a chat by id or by title, or to a person
52
- as `user:<id>`; `--md`, `--html`, a file or a photo. `bot store fetch` imports older channel and supergroup messages;
53
- `messages list` reads what this bot sent, received or imported on this computer.
54
- History import uses a separate MTProto session; private chats and basic groups are unsupported.
55
- - **Admins, members, buttons, the menu, webhooks.** `bot chats admins`, `bot chats members remove`,
56
- `bot callbacks answer`, `bot commands`, `bot webhooks` — the same commands `max bot` has.
57
- - **`bot watch`** prints what happens in the bot's chats as it arrives, and keeps it: that is the
58
- bot's history on this computer.
59
-
60
- In full: [docs/bot.md](docs/bot.md).
61
-
62
- ## The personal account
63
-
64
- `tg` works with your own account, as one more of your devices: every chat, its history, groups,
65
- channels and contacts. It is not a bot: it talks to Telegram over MTProto, Telegram's own API for
66
- client apps, with an app you register yourself.
46
+ ## Quick start
67
47
 
68
48
  ```sh
69
- tg chats list --limit 5
70
- tg messages list "Book club"
71
- tg messages send "Book club" "Running 15 minutes late"
49
+ npm install -g @wirecat/tg-cli # or: pnpm add -g @wirecat/tg-cli, bun add -g @wirecat/tg-cli
50
+ tg setup --agent claude # also codex, cursor, gemini, all or none
51
+ tg inbox # other people's unread messages, in every chat; nothing is marked read
72
52
  ```
73
53
 
74
- In full: [docs/usage.md](docs/usage.md).
54
+ Allow about five minutes. `tg setup` registers your own Telegram app at
55
+ [my.telegram.org](https://my.telegram.org/apps), logs in by QR code, checks your first chats and installs
56
+ the agent skill. Downloading older history is a separate step.
75
57
 
76
- ## How to use it
58
+ It needs **Node 22.16+ or 24+**, or **Bun**, on macOS, Linux or Windows. Try it without installing:
59
+ `npx @wirecat/tg-cli --help`.
77
60
 
78
- - **A check on a schedule.** Morning and evening, the agent looks at what came in and sends you a
79
- short summary: who is waiting for an answer, what is urgent, what you can skip.
80
- - **Reports.** A week of a work chat: what was decided, who took what on, which questions are still
81
- open.
82
- - **Who owes what.** `tg review` hands over everything said since the last review in one call, your
83
- own messages too. The agent sorts it into "I owe", "waiting on others" and "needs clarifying".
84
- - **Reminders.** Whom you promised an answer and did not give one; whose question has waited three
85
- days.
86
- - **Draft replies.** The agent proposes the text, and you send it — or it sends, if you allowed it
87
- to write to that chat.
88
- - **Search.** "When did we agree to meet Anna?" — an answer with the date and the message itself.
89
- - **A group you run.** Which questions nobody answered, who joined this week
90
- ([groups.md](docs/groups.md)).
61
+ More: [installation guide](https://github.com/WireCatLabs/tg-cli/blob/main/docs/installation.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/installation)
91
62
 
92
- What that looks like:
63
+ ## What can you do?
93
64
 
94
- ```text
95
- You: What did I promise anyone in the last three days?
96
- Agent: (calls tg review: 12 chats)
97
- I owe
98
- · Anna — send the invoice by Friday. "Anna", 24.09
99
- Waiting on others
100
- · Boris — the mock-up by 25.09. Not in "Design" yet
101
- Needs clarifying
102
- · "Project Alpha": who brings the samples — "we'll decide later", 25.09
103
- Next review — from 26.09, 14:05.
104
- You: Remind Boris about the mock-up.
105
- Agent: Draft: "Boris, hi! How is the mock-up going?" Send it?
106
- You: Yes.
65
+ **Catch up.** *"Use tg CLI. What came in since this morning, and who is waiting for my answer?"*
66
+
67
+ ```sh
68
+ tg inbox
69
+ tg review --since-time 1d
107
70
  ```
108
71
 
109
- Set sending to `ask` in the profile's `permissions` for confirmation in the terminal. Over MCP,
110
- `ask` permits the requested write; configure approval in the agent app. Reading marks nothing read.
111
- Ready requests, a schedule and limits for each job: [recipes.md](docs/recipes.md).
72
+ **Find anything.** *"Use tg CLI. When did we agree on the venue with Alice?"* — an answer with the date
73
+ and the message itself.
112
74
 
113
- ## Groups you run
75
+ ```sh
76
+ tg search all "venue" # messages, mail and notes kept on this computer
77
+ ```
78
+
79
+ **Keep your promises.** *"Use tg CLI. What did I promise, and what am I still waiting on?"* `tg review`
80
+ hands over everything said since the last review in one call, your own messages too.
114
81
 
115
82
  ```sh
116
- tg review --chat "Hiking" --unanswered # questions nobody answered in 24 hours
117
- tg chats events "Hiking" --since-time 7d # who joined, left, was added or removed, and by whom
118
- tg chats members list "Hiking" --all # everyone, with their role and when they were last seen
119
- tg topics list "Hiking" # a forum group's topics, newest activity first
120
- tg chats inspect https://t.me/+AbCdEf # where an invite link leads, without joining
121
- tg chats create "Hiking 2027" @olga # a new group, with the people you name
83
+ tg review --new # what changed since the last review --new
122
84
  ```
123
85
 
124
- Renaming a group, adding and removing members and admins, resetting its invite link and moderation
125
- rules for links, forwards and floods are commands too. In full: [docs/groups.md](docs/groups.md).
86
+ **Run your groups.** *"Use tg CLI. Which questions in Hiking has nobody answered?"*
126
87
 
127
- Enable topics with `topics enable`. Only the group owner can do this. A basic group needs
128
- `--upgrade --yes`, which permanently changes its chat id; the result gives the new address.
129
- An existing supergroup needs no upgrade. `topics create` creates a named topic; on an unknown
130
- outcome, check the list and never repeat an unknown creation. Existing archive rows keep
131
- their original chat ids; histories are not automatically merged across the migration.
88
+ ```sh
89
+ tg review --chat "Hiking" --unanswered
90
+ tg chats events "Hiking" --since-time 7d # who joined, left, was added or removed
91
+ ```
132
92
 
133
- Send into a forum topic with `messages send --topic` or `polls create --topic`. Use the id from
134
- `topics list`; an explicit reply must belong to that topic. Text, photo/file captions and scheduled
135
- sends keep the topic. Closed or missing topics are refused before sending. On an unknown outcome,
136
- repeat with the same send id, chat and topic; check the scheduled queue instead of repeating a
137
- scheduled send.
93
+ More: [recipes, with a schedule and limits for each](https://github.com/WireCatLabs/tg-cli/blob/main/docs/recipes.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/recipes)
138
94
 
139
- ## How it works
95
+ ## Built for AI agents
140
96
 
141
- `tg` works in your name, as one more of your devices. It is not a bot: it talks to Telegram over
142
- MTProto, Telegram's own API for client apps, with an app you register yourself. From then on `tg`
143
- sees your chats, their history, groups, channels and contacts.
97
+ Your agent. Your Telegram. Your rules.
144
98
 
145
- An agent connects to `tg` in one of two ways:
99
+ - **Agents with a terminal** (for example Claude Code, Codex, Gemini CLI) run `tg` commands
100
+ themselves. The bundled [skill](https://github.com/WireCatLabs/tg-cli/blob/main/skills/tg-cli/SKILL.md)
101
+ tells them how: `tg setup --agent …` or `tg skill install` puts it in place, and `tg skill show`
102
+ prints it before login.
103
+ - **Apps without a terminal** (for example Claude Desktop, Cursor and other MCP clients) connect to
104
+ `tg mcp`. It comes with ready prompts: `/catch-up`, `/review`, `/reply` and `/find`.
146
105
 
147
- - **An agent with a terminal** — Claude Code, Codex, Gemini CLI. It runs `tg` commands itself. Give
148
- it the [skill](skills/tg-cli/SKILL.md): instructions for working with `tg`, installed with one
149
- command ([recipes.md](docs/recipes.md#once-first)).
150
- - **An agent without a terminal** — Claude Desktop, Cursor and other MCP clients. Connect `tg mcp`;
151
- `tg mcp config` prints the entry for their settings. It comes with ready prompts: `/catch-up`
152
- (what is new), `/review` (who owes what), `/reply` (a draft answer) and `/find` (search). The
153
- profile's `permissions` decide what the agent may do ([mcp.md](docs/mcp.md#what-an-agent-may-do)).
106
+ ```sh
107
+ tg mcp setup claude-code # or: tg mcp setup codex
108
+ tg mcp config # the entry for Claude Desktop, Cursor and others
109
+ ```
154
110
 
155
- ## What it can do
111
+ More: [the MCP server](https://github.com/WireCatLabs/tg-cli/blob/main/docs/mcp.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/mcp)
156
112
 
157
- - **Read.** Chats, history, one message with its neighbours, other people's unread messages in every
158
- chat at once (`tg inbox`), everything since the last review (`tg review`), new messages as they
159
- arrive (`tg watch`), a message's files or a whole chat's, voice messages as text.
160
- - **Search.** Messages by their text, across the local archive and Telegram by default;
161
- `--backend archive` keeps search local, and `--sync-first` fetches new messages before searching.
162
- Use `--regex` for a pattern. Chats by part of their title, contacts by part of a name, a person by phone number.
163
- - **Write.** Text with Markdown, replies, files, photos, videos and voice messages, silent messages,
164
- scheduled messages that go out even with this computer off, edits, forwards, pins, reactions,
165
- polls, deletion — for you or for everyone.
166
- - **Keep an archive.** Fetch a chat's history into the local store, in the background if it is long;
167
- keep the store current with `tg serve`, as a systemd or launchd service; export a chat as JSON
168
- lines or Markdown; back the store up and restore it while it is in use ([archive.md](docs/archive.md)).
169
- - **One request pace per profile**, shared by every command, job and server at once, so bulk work stays
170
- under Telegram's limits; long waits stop the run instead of being repeated ([limits.md](docs/limits.md)).
171
- - **Groups and channels.** Create a group or a channel, join by a link, leave; rename it, add and
172
- remove members and admins, reset its invite link; who joined and left, forum topics, where an
173
- invite link leads; moderation rules for links, forwards and floods, applied when you run them
174
- ([groups.md](docs/groups.md)).
175
- - **Contacts and the account.** Add, rename, block and import contacts; who you are logged in as,
176
- and every device and app logged in to the account.
177
- - **About one person.** Their profile, last seen and when they registered; how many of their
178
- messages you hold in each shared chat; their latest messages per chat for an agent to summarise;
179
- and whether the account looks like a bot or a spammer, public spam lists included
180
- ([people.md](docs/people.md)).
181
-
182
- ## Why it is good
183
-
184
- - **It reads without a trace.** Reading marks nothing read: the other side does not see that you
185
- opened the chat. Mark it read when you want to: `tg chats mark-read`.
186
- - **An agent cannot write more than you allowed.** A profile can be read-only, allow only some
187
- actions, send only to the chats on its list, and send at most 30 messages an hour. When a name
188
- fits two chats, `tg` does not pick one: it shows both ([security.md](docs/security.md#the-send-guard)).
189
- - **A message is never sent twice.** If the connection breaks while a message is sent, `tg` says
190
- plainly that it does not know whether it went, and gives the command to repeat it. Telegram
191
- recognises the repeat and does not create a second message
192
- ([usage.md](docs/usage.md#when-the-outcome-is-unknown)).
193
- - **Your own copy of your messages.** Everything read is kept on your computer. Search over it is
194
- fast, and `--offline` answers from it without connecting at all.
195
- - **Voice messages as text, on your computer.** Telegram transcribes for Premium accounts; `tg` can
196
- also run a speech model on this machine, downloaded only when you ask
197
- ([usage.md](docs/usage.md#voice-messages)).
198
- - **Other people's text does not control your terminal.** Control characters in names, titles and
199
- messages are shown as text, and a name is printed on one line
200
- ([security.md](docs/security.md#other-peoples-text-on-your-screen)).
201
- - **No secret on the command line.** No command takes a password, a login code or a phone number as
202
- an argument. The app keys are in the system keyring.
203
- - **Easy to read for a script and an agent.** With `--json`, a command prints data and nothing else,
204
- always in the same shape. An error comes separately, with its own exit code
205
- ([usage.md](docs/usage.md#for-scripts-and-agents)).
206
- - **Problems can be looked at without your messages.** `--trace` shows each request to Telegram and
207
- holds no text, names, phone numbers or keys, so it can go into a bug report
208
- ([diagnostics.md](docs/diagnostics.md)).
209
-
210
- ## Custom work
211
-
212
- We build process automation and tools for your task: integrations with Telegram and other
213
- messengers, AI agents, internal services. Write to [info@neirox.ai](mailto:info@neirox.ai).
113
+ ## Why tg?
214
114
 
215
- ## How it differs
115
+ - **Your whole account, not only bots.** Every chat, group, channel and contact, with its history —
116
+ `tg` is one more of your devices.
117
+ - **Local-first search.** Everything read is kept on your computer. Search is fast, and `--offline`
118
+ answers without connecting.
119
+ - **Made for agents.** One operation per call, the same JSON shape every time with `--json`, a fixed
120
+ exit code for each kind of failure, an MCP server and a skill.
121
+ - **Safe by default.** Reading marks nothing read. A profile decides which actions an agent may take,
122
+ which chats it may send to, and how many messages an hour (30 by default). When a send's outcome is
123
+ unknown, `tg` says so and gives a repeat command that Telegram does not deliver twice.
124
+ - **The full Bot API too.** All 185 methods, next to the convenient bot commands.
216
125
 
217
- There are good tools for a Telegram account already. Choose what fits the job:
218
- [Compared with other tools](docs/compare.md) puts `tg` next to tgcli, telegram-mcp and tdl, feature by
219
- feature.
126
+ More: [compared with other tools](https://github.com/WireCatLabs/tg-cli/blob/main/docs/compare.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/compare)
220
127
 
221
- **Telegram's own apps** are made for a person. `tg` is made for a script and an agent: one operation
222
- per call, the same shape of answer every time, a limit on what an agent may send, your messages
223
- searchable offline, and nothing marked read by reading.
128
+ ## Your account
224
129
 
225
- **Bots.** A Telegram bot, through the [Bot API](https://core.telegram.org/bots/api), sees only the
226
- chats it was added to and speaks as the bot. `tg` is you: your chats, in your name. `tg bot` drives a bot of
227
- yours through that API ([bot.md](docs/bot.md)).
130
+ `tg` works in your name, as one more of your devices. It is not a bot: it talks to Telegram over
131
+ MTProto, Telegram's own API for client apps, with an app you register yourself. It sees your chats,
132
+ their history, groups, channels and contacts.
228
133
 
229
- ## Contents
134
+ ```sh
135
+ tg chats list --limit 5
136
+ tg messages list "Book club" --limit 20
137
+ tg messages send "Book club" "Call at 3?" --reply-to <id>
138
+ tg reactions add "Book club" <id> 👍
139
+ tg messages send me "Call mum" --at-time 2h # a reminder in Saved Messages in two hours
140
+ tg messages send "Book club" "The minutes" --file minutes.pdf
141
+ tg messages download "Book club" <id> --output-dir ~/Downloads
142
+ tg messages transcribe "Book club" <id> # a voice message as text
143
+ ```
230
144
 
231
- - [The bot](#the-bot)
232
- - [The personal account](#the-personal-account)
233
- - [Groups you run](#groups-you-run)
234
- - [Install](#install)
235
- - [Log in](#log-in)
236
- - [Use](#use)
237
- - [For scripts and agents](#for-scripts-and-agents)
238
- - [Security](#security)
239
- - [Documentation](#documentation)
240
- - [Development](#development)
241
- - [Roadmap](#roadmap)
242
- - [Licence](#licence)
243
- - [Contributing](#contributing)
145
+ - **Read.** Chats, history, one message with its neighbours, other people's unread messages in every
146
+ chat (`tg inbox`), everything since the last review (`tg review`), new messages as they arrive
147
+ (`tg watch`), a message's files, voice messages as text.
148
+ - **Write.** Markdown, replies, files, photos, videos and voice messages, silent and scheduled messages
149
+ (they go out even with this computer off), edits, forwards, pins, reactions, polls, deletion — for
150
+ you or for everyone.
151
+ - **Voice on your computer.** Telegram transcribes for Premium accounts; `tg` can also run a speech
152
+ model on this machine, downloaded only when you ask.
153
+ - **Contacts and the account.** Add, rename, block and import contacts; your own aliases and notes
154
+ for people; who you are logged in as, and every device logged in to the account.
155
+ - **One person.** Their profile, when they were last seen, their messages per shared chat, and whether
156
+ the account looks like a bot or a spammer.
244
157
 
245
- ## Install
158
+ More: [using tg](https://github.com/WireCatLabs/tg-cli/blob/main/docs/usage.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/usage) · [one person](https://github.com/WireCatLabs/tg-cli/blob/main/docs/people.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/people)
246
159
 
247
- The package is **`@wirecat/tg-cli`**; the command it installs is **`tg`**.
160
+ ## Log in and profiles
248
161
 
249
- Try it without installing:
162
+ Every user registers their own Telegram app; `tg setup` or `tg session start` does it for you. The
163
+ app keys go to the system keyring, and the session is a file only your user can read.
250
164
 
251
165
  ```sh
252
- npx @wirecat/tg-cli --help
166
+ tg session start # a QR code: Settings → Devices → Link Desktop Device
167
+ tg session start phone # or a phone number, the code and your 2FA password
168
+ tg session start --qr-file login.png # the QR code as a picture, for an agent to show you
169
+ tg account show # who you are logged in as
170
+ tg account list # every profile here, and who each is logged in as
253
171
  ```
254
172
 
255
- Install it:
173
+ Several accounts are several profiles, and the profile is **the first word**, not an option:
256
174
 
257
175
  ```sh
258
- npm install -g --allow-scripts=@wirecat/tg-cli --foreground-scripts @wirecat/tg-cli # or: pnpm add -g @wirecat/tg-cli, bun add -g @wirecat/tg-cli
259
- tg --version
260
- tg setup # guided first run; allow about five minutes
176
+ tg chats list # profile "default"
177
+ tg work chats list # profile "work"
178
+ export TG_PROFILE=work # or for the whole shell session
261
179
  ```
262
180
 
263
- For an agent, read `tg skill show` before login and use `tg setup --agent codex`.
264
- `tg --help` and `tg setup --help` show the next steps.
181
+ More: [login and sessions](https://github.com/WireCatLabs/tg-cli/blob/main/docs/sessions.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/sessions) · [profiles](https://github.com/WireCatLabs/tg-cli/blob/main/docs/profiles.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/profiles)
265
182
 
266
- It needs **Node 22.16 or newer**, or **Bun** — CI runs the built command under both — on macOS, Linux
267
- or Windows. SQLite comes from the
268
- runtime itself, or from tg's own copy when a Linux Node's system SQLite is too old, so there is
269
- nothing to compile. `tg doctor` says where its files are and whether a
270
- session is saved, without connecting; `tg doctor --online` checks the login works. Details, variables and where the files go:
271
- [docs/installation.md](docs/installation.md).
183
+ ## The local store and search
272
184
 
273
- ### Windows installation
185
+ Everything `tg` reads is kept in a local store on your computer. Search runs over it and over
186
+ Telegram by default; `--offline` answers from the store without connecting.
274
187
 
275
- ```powershell
276
- & ([scriptblock]::Create((Invoke-RestMethod 'https://wirecat.dev/install.ps1'))) -Tool tg -Agent all
188
+ ```sh
189
+ tg search messages "contract" --chat "Project Alpha"
190
+ tg search messages "contract" --backend archive # local only
191
+ tg store fetch "Project Alpha" --last 5000 --background
192
+ tg store export "Project Alpha" --format markdown --output alpha.md
193
+ tg messages evidence "Project Alpha" --json # bounded evidence for a chat brief
194
+ tg server install # keep the store current as a systemd or launchd service
195
+ tg store backup ~/tg-backup.db # a copy, safe while the store is in use
277
196
  ```
278
197
 
279
- This single installer call saves the npm command folder to user PATH, updates this PowerShell,
280
- installs the bundled agent skill and verifies bare `tg`. It preserves existing PATH entries,
281
- works when npm skips lifecycle scripts and leaves PowerShell execution policy unchanged.
282
- An agent reads `tg skill show` before guiding login. Installation itself contacts no account.
283
- See [installation](docs/installation.md#windows-one-install-command).
198
+ Search by words, people, dates, files, links and tags; save searches; find discussions by topic.
284
199
 
285
- ## Log in
200
+ More: [search](https://github.com/WireCatLabs/tg-cli/blob/main/docs/search.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/search) · [the local store](https://github.com/WireCatLabs/tg-cli/blob/main/docs/archive.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/archive)
286
201
 
287
- For a first run, use the guided command in your terminal:
202
+ ## Groups you run
288
203
 
289
204
  ```sh
290
- tg setup --agent codex # also: cursor, claude, gemini, all or none
205
+ tg review --chat "Hiking" --unanswered # questions nobody answered in 24 hours
206
+ tg chats events "Hiking" --since-time 7d # who joined, left, was added or removed, and by whom
207
+ tg chats members list "Hiking" --all # everyone, with their role and when they were last seen
208
+ tg topics list "Hiking" # a forum group's topics, newest activity first
209
+ tg chats inspect https://t.me/+AbCdEf # where an invite link leads, without joining
210
+ tg chats create "Hiking 2027" @alice_example # a new group, with the people you name
211
+ tg stats chats show "Hiking" # group activity
291
212
  ```
292
213
 
293
- Allow about five minutes. It checks local directories, obtains your Telegram app keys, logs in
294
- by QR code, checks the first five chats and installs the selected agent skill. Without `--agent`,
295
- it asks at a terminal; machine output defaults to `none`. A repeat run checks the existing session.
296
- History downloads are a separate step: choose a chat before `tg store fetch <chat> --last 100`.
297
- If automatic app registration fails, use `tg session start --app browser`, then rerun setup.
214
+ Renaming a group, adding and removing members and admins, join requests, invite links, forum topics
215
+ and moderation rules for links, forwards and floods are commands too.
298
216
 
299
- Every user registers their own Telegram app at [my.telegram.org](https://my.telegram.org/apps).
300
- `tg session start` asks for it the first time; `--app auto` fills in the site for you.
217
+ More: [groups you run](https://github.com/WireCatLabs/tg-cli/blob/main/docs/groups.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/groups)
301
218
 
302
- ```sh
303
- tg session start # a QR code in the terminal: Settings → Devices → Link Desktop Device
304
- tg session start phone # or a phone number, the code, and your 2FA password
305
- tg session start --qr-file login.png # the QR code as a picture, for an agent to show you
306
- tg account show # who you are logged in as
307
- tg account list # every profile here, and who each is logged in as
308
- ```
219
+ ## A bot
309
220
 
310
- Several accounts are several profiles, and the profile is **the first word**, not an option:
221
+ `tg bot` works with a bot through Telegram's official [Bot API](https://core.telegram.org/bots/api) and
222
+ its token from [@BotFather](https://t.me/BotFather). You can keep several bots; each has a name you
223
+ choose, and that name is the first word of the command.
311
224
 
312
225
  ```sh
313
- tg chats list # profile "default"
314
- tg work chats list # profile "work"
315
- export TG_PROFILE=work # or for the whole shell session
226
+ tg sales bot auth set # the token, at a hidden prompt; Telegram checks it first
227
+ tg sales bot auth show # which bot it is
228
+ tg sales bot recipients add user:<id> # the bot may write only here
229
+ tg sales bot messages send "Team" "Build is ready" --file report.pdf
230
+ tg sales bot api --help # every Bot API method, each with its fields
231
+ tg bot list --check # every bot on this computer
316
232
  ```
317
233
 
318
- The app, the session and profiles: [docs/sessions.md](docs/sessions.md).
234
+ - **Every Bot API method.** `tg <bot> bot api <method>` takes native field flags or a JSON body.
235
+ - **One token per name, in the keyring**, apart from your own login; `TG_BOT_TOKEN` for CI. The token
236
+ is never printed — not in an error, not with `--trace`, not in a run record.
237
+ - **Recipients and a journal.** Each bot has its own list of chats it may write to, and a journal of
238
+ what it did, without the text.
239
+ - **Messages, admins, members, buttons, the menu, webhooks** — send, edit, delete and pin; `bot chats
240
+ admins`, `bot callbacks answer`, `bot commands`, `bot webhooks`.
241
+ - **History.** `bot watch` prints and keeps what happens in the bot's chats; `bot store fetch` imports
242
+ older channel and supergroup messages.
243
+
244
+ More: [a Telegram bot](https://github.com/WireCatLabs/tg-cli/blob/main/docs/bot.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/bot)
319
245
 
320
- ## Use
246
+ ## Agent setup in detail
321
247
 
322
- **A conversation in your name:**
248
+ **The skill.** Claude Code reads `~/.claude/skills/tg-cli/`; Codex, Gemini CLI and local Cursor read
249
+ `~/.agents/skills/tg-cli/`. Start a new agent session if it does not see the skill.
323
250
 
324
251
  ```sh
325
- tg inbox # unread in every chat, nothing marked read
326
- tg messages list "Book club" --limit 20
327
- tg messages send "Book club" "Call at 3?" --reply-to <id>
328
- tg reactions add "Book club" <id> 👍
329
- tg messages send me "Call mum" --at-time 2h # a reminder in Saved Messages in two hours
330
- tg review --since-time 1d # a day of messages: who promised what
252
+ tg skill install --for all # both folders, without logging in
253
+ tg skill show # the complete instructions, without installing them
331
254
  ```
332
255
 
333
- **Files and voice:**
256
+ **The MCP server.** The profile's `permissions` decide which tools it offers. `readonly` stops the
257
+ agent from changing anything; at `ask` the server shows no form, so set up approval in your agent app.
334
258
 
335
259
  ```sh
336
- tg messages send "Book club" "The minutes" --file minutes.pdf
337
- tg messages download "Book club" <id> --output-dir ~/Downloads
338
- tg messages transcribe "Book club" <id> # a voice message as text
260
+ claude mcp add tg -- tg mcp # Claude Code, by hand
261
+ tg mcp doctor # check the local MCP server
339
262
  ```
340
263
 
341
- **Find and keep:**
264
+ **From the browser.** ChatGPT or Claude in the browser reach `tg mcp --http --public-url <url>` behind
265
+ your tunnel, after a login with a one-time access code from your terminal.
342
266
 
343
- ```sh
344
- tg search all "contract" # messages, mail and notes kept, without connecting
345
- tg messages evidence "Project Alpha" --json # bounded evidence for a chat brief
346
- tg store fetch "Project Alpha" --last 5000 --background
347
- tg store export "Project Alpha" --format markdown --output alpha.md
348
- tg server install # keep the store current as a service
349
- ```
267
+ More: [the MCP server](https://github.com/WireCatLabs/tg-cli/blob/main/docs/mcp.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/mcp) · [remote access](https://github.com/WireCatLabs/tg-cli/blob/main/docs/remote.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/remote)
350
268
 
351
- Every command answers in JSON with `--json`, and every send goes into a journal — without its text.
269
+ ## Output for scripts and agents
352
270
 
353
- In full: [docs/usage.md](docs/usage.md). Every command and option:
354
- [docs/commands.md](docs/commands.md) — generated from the program itself, so it cannot describe a
355
- version that does not exist.
271
+ With `--json` a command prints only data, as one JSON value — no tables, colour or hints; it does the
272
+ same when another program reads its output. `--jsonl` prints one object per line. Every list has one
273
+ shape:
356
274
 
357
- ## For scripts and agents
275
+ ```json
276
+ { "items": [ … ], "page": 1, "limit": 20, "hasMore": true }
277
+ ```
358
278
 
359
- ### A skill for agents with a terminal
279
+ An error goes to stderr as one line, with stdout empty, and the command exits with a fixed code: `4`
280
+ log in, `5` the profile may not do this, `6` chat or message not found, `8` a limit, `9` Telegram did
281
+ not answer in time, `14` unknown whether a message went. `tg commands --json` is the whole command
282
+ tree. A partial read or download can exit `0`: check `complete` in the JSON.
360
283
 
361
- A skill is a file of instructions an agent reads before it works. The bundled skill is available
362
- before login through `tg skill show`. It explains setup, reading, permissions and safe sending.
363
- Guided setup installs it for your chosen agent; an already configured account can install it
364
- separately:
284
+ More: [CLI contract](https://github.com/WireCatLabs/tg-cli/blob/main/docs/cli-contract.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/cli-contract) · [every command and exit code](https://github.com/WireCatLabs/tg-cli/blob/main/docs/commands.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/commands)
285
+
286
+ ## Settings and permissions
365
287
 
366
288
  ```sh
367
- tg setup --agent codex # also cursor, claude, gemini, all or none
368
- tg skill install --for all # install both supported skill directories, without logging in
369
- tg skill show # read the complete instructions without installing them
289
+ tg config set permissions.messages readonly # no change to messages from this profile
290
+ tg config set permissions.messages.send ask # a question in the terminal before each send
291
+ tg config set sendsPerHour 10 # at most 10 sends an hour (30 by default)
292
+ tg recipients add "Book club" # the first add turns the recipient list on
293
+ tg sends list # every attempt: sent, refused, failed or not known
294
+ tg config show # what is set, and where it came from
370
295
  ```
371
296
 
372
- Claude Code uses `~/.claude/skills/tg-cli/`. Codex, Gemini CLI and local Cursor use
373
- `~/.agents/skills/tg-cli/`. Start a new agent session after installation if it does not see the
374
- skill. The installed instructions come from the same package version as `tg`.
297
+ More: [permissions](https://github.com/WireCatLabs/tg-cli/blob/main/docs/permissions.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/permissions) · [configuration](https://github.com/WireCatLabs/tg-cli/blob/main/docs/configuration.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/configuration)
375
298
 
376
- How these agents find skills: [Codex](https://learn.chatgpt.com/docs/build-skills),
377
- [Gemini CLI](https://geminicli.com/docs/cli/skills/),
378
- [Cursor](https://cursor.com/docs/skills).
299
+ ## Limits
379
300
 
380
- ### An MCP server for agents without a terminal
301
+ Each profile has one request pace, shared by every command, background job and server at once, so
302
+ bulk work stays under Telegram's limits. Short waits from Telegram are waited out; a long wait stops
303
+ the run instead of being repeated.
381
304
 
382
- Claude Desktop, Cursor and other MCP clients connect to `tg mcp` and work with the same account.
383
- The profile's `permissions` decide which commands it gets: by default it can send, react, mark
384
- read and delete your own messages, with no form. Set a level to `readonly` to keep the agent from
385
- changing it; to see each change first, leave `tg_write` unapproved in your client.
386
- In full: [docs/mcp.md](docs/mcp.md).
305
+ More: [limits and waits](https://github.com/WireCatLabs/tg-cli/blob/main/docs/limits.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/limits)
387
306
 
388
- ```sh
389
- claude mcp add tg -- tg mcp # Claude Code
390
- tg mcp doctor # check the local MCP server
391
- tg mcp setup codex # add it to Codex
392
- tg mcp setup claude-code # add it to Claude Code
393
- tg mcp config # the entry for Claude Desktop, Cursor and others, with full paths
394
- ```
307
+ ## Security
308
+
309
+ - The session file is as good as your password, readable only by your user; the app keys are in the
310
+ system keyring. No command takes a password, a login code or a phone number as an argument.
311
+ - The local store holds the full text of what was read, unencrypted and readable only by your user.
312
+ It stays after logout; only whole-disk encryption protects it from a stolen disk.
313
+ - Every send, from a command or over MCP, passes the profile's limits and is written to a journal —
314
+ without its text. `--file` refuses credential files, CLI folders and the local store.
315
+ - Control characters in names, titles and messages are shown as text, so other people's text cannot
316
+ control your terminal.
317
+ - The limits stop an agent talked into sending by a message it read, not one that sets out to get
318
+ round them: for that, run the agent in a sandbox or as a separate user.
395
319
 
396
- The server's prompts — `/catch-up`, `/review`, `/reply`, `/find` — are ready requests: the agent
397
- knows which tools to call and what not to do. ChatGPT or Claude in the browser can reach it too,
398
- through a login proxy and a tunnel: [docs/remote.md](docs/remote.md).
320
+ To report a vulnerability: [SECURITY.md](https://github.com/WireCatLabs/tg-cli/blob/main/SECURITY.md).
399
321
 
400
- ### Answers in JSON
322
+ More: [security](https://github.com/WireCatLabs/tg-cli/blob/main/docs/security.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/security)
323
+
324
+ ## When something goes wrong
401
325
 
402
326
  ```sh
403
- tg chats list --json
327
+ tg doctor # where the files are and whether a session is saved, without connecting
328
+ tg doctor --online # check that the login works
329
+ tg chats list --trace # each request to Telegram, with no text, names, phone numbers or keys
330
+ tg runs list # recorded runs
404
331
  ```
405
332
 
406
- With `--json` a command prints only data, as one JSON value — no tables, colour or hints. It does
407
- the same when another program reads its output, as in `tg … | jq`. `--jsonl` prints one object per
408
- line. Every list comes in one shape:
333
+ More: [troubleshooting by symptom](https://github.com/WireCatLabs/tg-cli/blob/main/docs/troubleshooting.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/troubleshooting) · [diagnostics](https://github.com/WireCatLabs/tg-cli/blob/main/docs/diagnostics.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/diagnostics)
409
334
 
410
- ```json
411
- { "items": [ … ], "page": 1, "limit": 20, "hasMore": true }
412
- ```
335
+ ## How it differs
413
336
 
414
- An error that ends the command comes apart from the data — one line on stderr, while stdout stays empty, so it cannot be
415
- taken for an empty result:
337
+ Telegram's own apps are made for a person; `tg` is made for a script and an agent. A Telegram bot sees
338
+ only the chats it was added to and speaks as the bot; `tg` is you, in your chats. Other open tools
339
+ connect a Telegram account to an agent too: tgcli, telegram-mcp and tdl.
416
340
 
417
- ```json
418
- {"error":{"code":"authentication_error","message":"…"}}
419
- ```
341
+ More: [compared with other tools](https://github.com/WireCatLabs/tg-cli/blob/main/docs/compare.md) · [on wirecat.dev](https://wirecat.dev/en/docs/tg/compare)
420
342
 
421
- An error that ends the command has a number — the exit code. A script decides what to do next by it: `4` log in, `5`
422
- the profile may not do this, `6` chat or message not found, `8` a limit, `9` Telegram did not answer
423
- in time, `14` unknown whether a message went. `tg commands --json` is the whole command tree, with
424
- every exit code. All codes: [docs/commands.md](docs/commands.md#exit-codes).
343
+ ## Part of WireCat
425
344
 
426
- Partial reads or downloads can return JSON with exit code `0`: check `complete` and `batch` or `issue`. Partial download JSONL adds `batch_summary`. [Resume unfinished work](docs/attachments.md#recover-a-partial-file-batch).
345
+ [WireCat](https://wirecat.dev) is an open-source, local-first context layer for AI agents. `tg` is
346
+ where it starts; [max-cli](https://github.com/WireCatLabs/max-cli) brings the MAX messenger into the
347
+ same local store. Start with Telegram. Add more context when you need it. Your context. Any agent.
427
348
 
428
- ## Security
349
+ ## Technical docs
429
350
 
430
- - The session is a file readable only by your user, and it is as good as your password: copying it
431
- copies the login. The app keys are in the system keyring.
432
- - The local store is readable only by your user. It holds the full text of what was read,
433
- unencrypted; only whole-disk encryption protects it from a stolen disk. It stays after logging out.
434
- - Before each send, from a command or over MCP, `tg` checks the profile's limits and writes a line to
435
- the journal — without the message's text.
436
- - A level of `ask` in `permissions` asks you in the terminal before a change; over MCP nobody is
437
- there to answer, so it goes ahead — use `readonly` to stop an agent. `--file` protects known credential
438
- files, CLI folders and the local store. Ordinary hidden working folders are allowed;
439
- `--allow-any-file` is available only in CLI, and MCP cannot override these protections.
440
- - The limits protect against an agent talked into sending by a message it read, not against one
441
- that sets out to get round them: against that you need a boundary outside — a sandbox or a
442
- separate user.
443
-
444
- In full — what reaches the disk, what goes over the network and what the tool never does:
445
- [docs/security.md](docs/security.md).
446
-
447
- ## Documentation
351
+ Every page is on [wirecat.dev/en/docs/tg](https://wirecat.dev/en/docs/tg) and in
352
+ [`docs/`](https://github.com/WireCatLabs/tg-cli/tree/main/docs):
448
353
 
449
354
  | Page | Answers |
450
355
  |---|---|
451
- | [installation](docs/installation.md) | requirements, where files go, shell completion, upgrade, removal |
452
- | [usage](docs/usage.md) | profiles, reading, paging, sending, scripts |
453
- | [sessions](docs/sessions.md) | QR and phone login, the app from my.telegram.org, the keyring, profiles, logout |
454
- | [archive](docs/archive.md) | the local store: fetch, search, export, `--offline`, `serve` as a service, backup |
455
- | [groups](docs/groups.md) | groups you run: unanswered questions, newcomers, a weekly report |
456
- | [people](docs/people.md) | one person: profile, what they said in each chat, does the account look like a bot |
457
- | [replies](docs/replies.md) | answer messages by your rules, to everyone or only the people you choose |
458
- | [mcp](docs/mcp.md) | Claude Desktop, Cursor and other clients without a terminal |
459
- | [remote](docs/remote.md) | ChatGPT or Claude in the browser, through a login proxy and a tunnel |
460
- | [recipes](docs/recipes.md) | an agent's daily work: summary, who owes what, unanswered, on a schedule |
461
- | [commands](docs/commands.md) | every command, option and exit code, generated from the program |
462
- | [configuration](docs/configuration.md) | common setup |
463
- | [configuration reference](docs/configuration-reference.md) | every key, type, default, scope and variable |
464
- | [CLI contract](docs/cli-contract.md) | output, errors, bounds and agent execution |
465
- | [diagnostics](docs/diagnostics.md) | `--trace`, `--record`, `runs`, `doctor report`, and what is never recorded |
466
- | [troubleshooting](docs/troubleshooting.md) | by symptom: what the screen says, and what to do |
467
- | [security](docs/security.md) | what reaches the disk and the network; the send guard |
468
- | [roadmap](docs/roadmap.md) | what is coming |
469
-
470
- What each version changed: [CHANGELOG.md](CHANGELOG.md).
356
+ | [index](https://github.com/WireCatLabs/tg-cli/blob/main/docs/index.md) · [web](https://wirecat.dev/en/docs/tg) | The docs site's start page: what `tg` is, the first minute, where to go next |
357
+ | [installation](https://github.com/WireCatLabs/tg-cli/blob/main/docs/installation.md) · [web](https://wirecat.dev/en/docs/tg/installation) | How do I install it, what does it need, where do its files go, how do I upgrade or remove it? |
358
+ | [usage](https://github.com/WireCatLabs/tg-cli/blob/main/docs/usage.md) · [web](https://wirecat.dev/en/docs/tg/usage) | How do I log in, read, page, send, and use it from a script — in that order? |
359
+ | [sessions](https://github.com/WireCatLabs/tg-cli/blob/main/docs/sessions.md) · [web](https://wirecat.dev/en/docs/tg/sessions) | How does login work: QR or phone, the app from my.telegram.org, the keyring, profiles, logout? |
360
+ | [archive](https://github.com/WireCatLabs/tg-cli/blob/main/docs/archive.md) · [web](https://wirecat.dev/en/docs/tg/archive) | What does the local store keep, how do I fill it, search it, export it, keep it current and back it up? |
361
+ | [search](https://github.com/WireCatLabs/tg-cli/blob/main/docs/search.md) · [web](https://wirecat.dev/en/docs/tg/search) | How do I find a message by its words, sender, chat, date, file, link or tag, save a search and count? |
362
+ | [attachments](https://github.com/WireCatLabs/tg-cli/blob/main/docs/attachments.md) · [web](https://wirecat.dev/en/docs/tg/attachments) | Sending, downloading and reading files; text from documents and images, and searching it |
363
+ | [rankings](https://github.com/WireCatLabs/tg-cli/blob/main/docs/rankings.md) · [web](https://wirecat.dev/en/docs/tg/rankings) | Message and author rankings: metrics, scores, saved queries and evidence |
364
+ | [topic-search](https://github.com/WireCatLabs/tg-cli/blob/main/docs/topic-search.md) · [web](https://wirecat.dev/en/docs/tg/topic-search) | How do I find a discussion by what it was about, keep that current, and what leaves my computer? |
365
+ | [query-language](https://github.com/WireCatLabs/tg-cli/blob/main/docs/query-language.md) · [web](https://wirecat.dev/en/docs/tg/query-language) | Every search field, operator, preset, limit and the JSON answer |
366
+ | [groups](https://github.com/WireCatLabs/tg-cli/blob/main/docs/groups.md) · [web](https://wirecat.dev/en/docs/tg/groups) | How do I keep up with a group I run — open questions, newcomers, a weekly report? |
367
+ | [people](https://github.com/WireCatLabs/tg-cli/blob/main/docs/people.md) · [web](https://wirecat.dev/en/docs/tg/people) | One person: profile, what they said in each chat, does the account look like a bot |
368
+ | [bot](https://github.com/WireCatLabs/tg-cli/blob/main/docs/bot.md) · [web](https://wirecat.dev/en/docs/tg/bot) | A bot through the Bot API: token, recipients, messages, admins and every Bot API method |
369
+ | [replies](https://github.com/WireCatLabs/tg-cli/blob/main/docs/replies.md) · [web](https://wirecat.dev/en/docs/tg/replies) | Answer messages by your rules, to everyone or only the people you choose |
370
+ | [mcp](https://github.com/WireCatLabs/tg-cli/blob/main/docs/mcp.md) · [web](https://wirecat.dev/en/docs/tg/mcp) | How do I connect Claude Desktop, Cursor or another client without a terminal? |
371
+ | [remote](https://github.com/WireCatLabs/tg-cli/blob/main/docs/remote.md) · [web](https://wirecat.dev/en/docs/tg/remote) | ChatGPT or Claude in the browser, through a login proxy and a tunnel |
372
+ | [recipes](https://github.com/WireCatLabs/tg-cli/blob/main/docs/recipes.md) · [web](https://wirecat.dev/en/docs/tg/recipes) | What can an agent do for me every day, and how do I run it on a schedule? |
373
+ | [compare](https://github.com/WireCatLabs/tg-cli/blob/main/docs/compare.md) · [web](https://wirecat.dev/en/docs/tg/compare) | How does tg compare with tgcli, telegram-mcp and tdl, and when does another tool fit better? |
374
+ | [commands](https://github.com/WireCatLabs/tg-cli/blob/main/docs/commands.md) · [web](https://wirecat.dev/en/docs/tg/commands) | Every command, option and exit code — **generated** from the program |
375
+ | [configuration](https://github.com/WireCatLabs/tg-cli/blob/main/docs/configuration.md) · [web](https://wirecat.dev/en/docs/tg/configuration) | How do I configure common behavior? |
376
+ | [permissions](https://github.com/WireCatLabs/tg-cli/blob/main/docs/permissions.md) · [web](https://wirecat.dev/en/docs/tg/permissions) | What a profile may read, what asks first, and what may go ahead |
377
+ | [profiles](https://github.com/WireCatLabs/tg-cli/blob/main/docs/profiles.md) · [web](https://wirecat.dev/en/docs/tg/profiles) | Several accounts and bots on one computer, and how a command picks one |
378
+ | [configuration-reference](https://github.com/WireCatLabs/tg-cli/blob/main/docs/configuration-reference.md) · [web](https://wirecat.dev/en/docs/tg/configuration-reference) | Every key, type, default, scope and variable |
379
+ | [cli-contract](https://github.com/WireCatLabs/tg-cli/blob/main/docs/cli-contract.md) · [web](https://wirecat.dev/en/docs/tg/cli-contract) | Invocation, output, errors, headless runs, bounds and previews |
380
+ | [limits](https://github.com/WireCatLabs/tg-cli/blob/main/docs/limits.md) · [web](https://wirecat.dev/en/docs/tg/limits) | Limits, waits and background jobs |
381
+ | [diagnostics](https://github.com/WireCatLabs/tg-cli/blob/main/docs/diagnostics.md) · [web](https://wirecat.dev/en/docs/tg/diagnostics) | What did a command do, and what is never recorded? |
382
+ | [troubleshooting](https://github.com/WireCatLabs/tg-cli/blob/main/docs/troubleshooting.md) · [web](https://wirecat.dev/en/docs/tg/troubleshooting) | Something does not work: what the screen says, and what to do |
383
+ | [security](https://github.com/WireCatLabs/tg-cli/blob/main/docs/security.md) · [web](https://wirecat.dev/en/docs/tg/security) | What reaches the disk, what never does, and what stops a send going to the wrong place? |
384
+ | [roadmap](https://github.com/WireCatLabs/tg-cli/blob/main/docs/roadmap.md) · [web](https://wirecat.dev/en/docs/tg/roadmap) | What is coming next? |
385
+
386
+ What each version changed: [CHANGELOG.md](https://github.com/WireCatLabs/tg-cli/blob/main/CHANGELOG.md).
471
387
 
472
388
  ## Development
473
389
 
474
390
  ```sh
475
391
  pnpm install
476
392
  pnpm lint && pnpm typecheck && pnpm test
477
- pnpm build && pnpm smoke:bun # the built command under the second runtime
393
+ pnpm build && pnpm smoke:bun # the built command under Bun
478
394
  pnpm generate # rewrites docs/commands.md from the command tree
479
395
  bin/tg session start # everything under .tg/ in this checkout, never the real profile
480
- bin/tg chats list --limit 5
481
396
  ```
482
397
 
483
398
  Everything that is not specific to Telegram — the commands, the store, the send guard, the MCP
484
399
  server — lives in [cli-messaging](https://github.com/WireCatLabs/cli-messaging), shared with
485
- [max-cli](https://github.com/WireCatLabs/max-cli). Telegram-specific code lives only in `src/telegram/`,
486
- and a lint rule keeps [mtcute](https://mtcute.dev), the Telegram library underneath, there.
487
-
488
- To work on `cli-messaging` at the same time, point the dependency at a checkout for the length of
489
- the change — `pnpm add @wirecat/cli-messaging@link:../cli-messaging` — and put the version back
490
- before the pull request.
491
-
492
- ## Roadmap
400
+ [max-cli](https://github.com/WireCatLabs/max-cli). Telegram-specific code lives only in `src/telegram/`.
493
401
 
494
- What is coming to `tg`, in the order it is likely to arrive. The order can change. Ideas and
495
- requests are welcome in [issues](https://github.com/WireCatLabs/tg-cli/issues).
402
+ More: [ARCHITECTURE](https://github.com/WireCatLabs/tg-cli/blob/main/docs/dev/ARCHITECTURE.md) ·
403
+ [TESTING](https://github.com/WireCatLabs/tg-cli/blob/main/docs/dev/TESTING.md)
496
404
 
497
- - **Richer sending** — several photos in one message
498
- ([usage.md](docs/usage.md#not-in-tg-yet)).
499
-
500
- What each released version changed is in [CHANGELOG.md](CHANGELOG.md).
405
+ ## Contributing
501
406
 
502
- ## Licence
407
+ Pull requests, bug reports and ideas are welcome in
408
+ [issues](https://github.com/WireCatLabs/tg-cli/issues).
503
409
 
504
- Apache License 2.0 — see [LICENSE](LICENSE).
410
+ Custom automation with Telegram, other messengers and AI agents: [info@neirox.ai](mailto:info@neirox.ai).
505
411
 
506
- ## Contributing
412
+ ## License
507
413
 
508
- Pull requests, bug reports and ideas are welcome —
509
- [issues](https://github.com/WireCatLabs/tg-cli/issues). How the code is built and how to test it:
510
- [docs/dev/ARCHITECTURE.md](docs/dev/ARCHITECTURE.md) and [docs/dev/TESTING.md](docs/dev/TESTING.md).
511
-
512
- For browser connectors, `tg mcp --http --public-url https://<name>.ts.net` serves behind your tunnel
513
- with an owner-code login. Profile permissions govern writes; the server has no confirmation forms. See [remote access](docs/remote.md).
514
- Group activity is available with `tg stats chats show <chat>`; [statistics](docs/groups.md#statistics-for-group-admins).
515
-
516
- ### Private contact notes and automatic tags
517
-
518
- `tg contacts alias set <person> <alias>` keeps a display name locally for the selected account;
519
- `contacts rename` updates the messenger address book. Write your own notes with
520
- `contacts notes add <person> --file <path>`, then use `list`, `show`, `edit --revision <n>` and
521
- `remove`. `contacts show --with-notes` includes notes explicitly; `contacts list --search-notes
522
- <text>` searches them. A contact's notes show in every account that sees the contact; an alias stays in
523
- its own account. Contact refresh preserves notes and aliases; linking people does not
524
- combine their private metadata.
525
-
526
- `tg metadata refresh --chat <id>` caches a group/channel description; `metadata get --chat <id>`
527
- reads that snapshot. `tags auto --chat <id> --dry-run` previews keyword labels. Use
528
- `--refresh-metadata` without `--dry-run` for current descriptions. Each run handles at most 500
529
- chats, 50 by default. Automatic labels preserve manual labels; `tags list|remove --source auto`
530
- selects generated claims. Classification uses no message text or external model.
414
+ Apache License 2.0 — see [LICENSE](https://github.com/WireCatLabs/tg-cli/blob/main/LICENSE).
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.48.0";
1
+ export declare const VERSION = "0.49.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = "0.48.0";
1
+ export const VERSION = "0.49.0";
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/tg-cli",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "A local command line interface for a personal Telegram account, built for agents and scripts",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",
@@ -64,7 +64,7 @@
64
64
  "dependencies": {
65
65
  "@mtcute/node": "0.32.3",
66
66
  "@wirecat/cli-core": "0.20.0",
67
- "@wirecat/cli-messaging": "0.240.0",
67
+ "@wirecat/cli-messaging": "0.246.0",
68
68
  "commander": "15.0.0",
69
69
  "undici": "7.30.0",
70
70
  "valibot": "1.5.0"