feat(telegram): make /ctx work everywhere (#159)

This commit is contained in:
banteg
2026-01-17 01:17:50 +04:00
committed by GitHub
parent b215279a3c
commit 419ec5078b
13 changed files with 390 additions and 20 deletions
+9 -3
View File
@@ -42,11 +42,17 @@ This line is parsed from replies and takes precedence over new directives.
| `/file put <path>` | Upload a document into the repo/worktree (requires file transfer enabled). |
| `/file get <path>` | Fetch a file or directory back into Telegram. |
| `/topic <project> @branch` | Create/bind a topic (topics enabled). |
| `/ctx` | Show topic context binding (topics enabled). |
| `/ctx set <project> @branch` | Update topic context binding. |
| `/ctx clear` | Remove topic context binding. |
| `/ctx` | Show context binding (chat or topic). |
| `/ctx set <project> @branch` | Update context binding. |
| `/ctx clear` | Remove context binding. |
| `/new` | Clear stored sessions for the current scope (topic/chat). |
Notes:
- Outside topics, `/ctx` binds the chat context.
- In topics, `/ctx` binds the topic context.
- `/new` clears sessions but does **not** clear a bound context.
## CLI
Takopis CLI is an auto-router by default; engine subcommands override the default engine.
+3
View File
@@ -119,6 +119,9 @@ When a message arrives in a chat whose `chat_id` matches `projects.<alias>.chat_
Takopi defaults the project context to that alias unless a reply `ctx:` or explicit
`/project` directive is present.
In non-topic chats, `/ctx` can bind a chat context. That bound context is treated as
ambient and takes precedence over the default project mapping until cleared.
## Worktree resolution
When `@branch` is present:
+2 -2
View File
@@ -204,8 +204,8 @@ Commands:
- `projects`: `/topic @branch` creates a topic in the project chat and binds it.
- `all`: use `/topic <project> @branch` in the main chat, or `/topic @branch` in
project chats.
- `/ctx` inside a topic shows the bound context and stored session engines.
`/ctx set ...` and `/ctx clear` update the binding.
- `/ctx` shows the bound context and stored session engines inside topics.
Outside topics, `/ctx set ...` and `/ctx clear` bind the chat context.
- `/new` inside a topic clears stored resume tokens for that topic.
State is stored in `telegram_topics_state.json` alongside the config file.