feat: add per-project chat routing (#76)

This commit is contained in:
banteg
2026-01-10 01:22:20 +04:00
committed by GitHub
parent 7ffb99d779
commit 81618e48e4
12 changed files with 299 additions and 14 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ See `docs/adding-a-runner.md` for the full guide and a worked example.
```
Telegram Update
telegram/bridge.poll_updates() drains backlog, long-polls, filters chat_id == cfg.chat_id
telegram/bridge.poll_updates() drains backlog, long-polls, filters allowed chat ids
telegram/bridge.run_main_loop() spawns tasks in TaskGroup
+6
View File
@@ -31,6 +31,7 @@ path = "~/dev/z80" # required (repo root)
worktrees_dir = ".worktrees" # optional, default ".worktrees"
default_engine = "codex" # optional, per-project override
worktree_base = "master" # optional, base for new branches
chat_id = -123 # optional, project chat id
```
Legacy config note: top-level `bot_token` / `chat_id` are auto-migrated into
@@ -52,6 +53,7 @@ Validation rules:
- `default_project` must match a configured project alias.
- Project aliases cannot collide with engine ids or reserved commands (`/cancel`).
- `default_engine` and per-project `default_engine` must be valid engine ids.
- `projects.<alias>.chat_id` must be unique and must not match `transports.telegram.chat_id`.
- `transport` defaults to `"telegram"` when omitted; override per-run with `--transport`.
## `takopi init`
@@ -95,6 +97,10 @@ code (backticked):
The `ctx:` line is parsed from replies and takes precedence over new directives.
When a message arrives in a chat whose `chat_id` matches `projects.<alias>.chat_id`,
Takopi defaults the project context to that alias unless a reply `ctx:` or explicit
`/project` directive is present.
## Worktree resolution
When `@branch` is present: