feat: transport registry and onboarding updates (#69)

This commit is contained in:
banteg
2026-01-08 12:55:15 +04:00
committed by GitHub
parent c0579a4ebd
commit 75d669bdd7
11 changed files with 442 additions and 110 deletions
+15 -1
View File
@@ -77,12 +77,25 @@ Defines `Transport`, `MessageRef`, `RenderedMessage`, and `SendOptions`.
Defines a renderer that converts `ProgressState` into `RenderedMessage` outputs.
### `transports.py` - Transport registry
Defines the transport backend protocol, registry helpers, and built-in transport registration.
### `config_migrations.py` - Config migrations
Applies one-time edits to on-disk config (e.g., legacy Telegram key migration) before
`TakopiSettings` validation runs.
### `telegram/backend.py` - Telegram transport backend
Adapter that validates Telegram config, runs onboarding, and builds/runs the Telegram bridge.
### `cli.py` - CLI entry point
| Component | Purpose |
|-----------|---------|
| `run()` / `main()` | Typer CLI entry points |
| `_parse_bridge_config()` | Reads config + builds `TelegramBridgeConfig` + `ExecBridgeConfig` |
| `_run_auto_router()` | Loads settings, resolves transport + engine, builds router, delegates to transport backend |
### `progress.py` - Progress tracking
@@ -261,6 +274,7 @@ Environment flags:
- `PI_CODING_AGENT_DIR` (override Pi agent session directory base path)
CLI flag: `--debug` enables debug logging (overrides `TAKOPI_LOG_LEVEL`).
CLI flag: `--transport <id>` overrides the configured transport backend.
### `telegram/onboarding.py` - Setup validation
+5 -1
View File
@@ -20,7 +20,7 @@ All config lives in `~/.takopi/takopi.toml`.
```toml
default_engine = "codex" # optional
default_project = "z80" # optional
transport = "telegram" # required
transport = "telegram" # optional, defaults to "telegram"
[transports.telegram]
bot_token = "..." # required
@@ -33,6 +33,9 @@ default_engine = "codex" # optional, per-project override
worktree_base = "master" # optional, base for new branches
```
Legacy config note: top-level `bot_token` / `chat_id` are auto-migrated into
`[transports.telegram]` on startup.
Note on `worktrees_dir`:
- The default `.worktrees` lives inside the repo root. You'll see it as an
@@ -49,6 +52,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.
- `transport` defaults to `"telegram"` when omitted; override per-run with `--transport`.
## `takopi init`