feat(cli): add takopi config subcommand (#153)

This commit is contained in:
banteg
2026-01-16 11:28:06 +04:00
committed by GitHub
parent dec93019b1
commit 92b33c5181
25 changed files with 1248 additions and 246 deletions
+24 -8
View File
@@ -9,10 +9,18 @@ Chat sessions store one resume token per engine per chat (per sender in group ch
If you chose **handoff** during onboarding and want to switch to chat mode:
```toml
[transports.telegram]
session_mode = "chat" # stateless | chat
```
=== "takopi config"
```sh
takopi config set transports.telegram.session_mode "chat"
```
=== "toml"
```toml
[transports.telegram]
session_mode = "chat" # stateless | chat
```
With `session_mode = "chat"`, new messages in the chat continue the current thread automatically.
@@ -32,10 +40,18 @@ Chat sessions do not remove reply-to-continue. If resume lines are visible, you
If you prefer a cleaner chat, hide resume lines:
```toml
[transports.telegram]
show_resume_line = false
```
=== "takopi config"
```sh
takopi config set transports.telegram.show_resume_line false
```
=== "toml"
```toml
[transports.telegram]
show_resume_line = false
```
## How it behaves in groups
+22 -10
View File
@@ -4,15 +4,28 @@ Upload files into the active repo/worktree or fetch files back into Telegram.
## Enable file transfer
```toml
[transports.telegram.files]
enabled = true
auto_put = true
auto_put_mode = "upload" # upload | prompt
uploads_dir = "incoming"
allowed_user_ids = [123456789]
deny_globs = [".git/**", ".env", ".envrc", "**/*.pem", "**/.ssh/**"]
```
=== "takopi config"
```sh
takopi config set transports.telegram.files.enabled true
takopi config set transports.telegram.files.auto_put true
takopi config set transports.telegram.files.auto_put_mode "upload"
takopi config set transports.telegram.files.uploads_dir "incoming"
takopi config set transports.telegram.files.allowed_user_ids "[123456789]"
takopi config set transports.telegram.files.deny_globs '[".git/**", ".env", ".envrc", "**/*.pem", "**/.ssh/**"]'
```
=== "toml"
```toml
[transports.telegram.files]
enabled = true
auto_put = true
auto_put_mode = "upload" # upload | prompt
uploads_dir = "incoming"
allowed_user_ids = [123456789]
deny_globs = [".git/**", ".env", ".envrc", "**/*.pem", "**/.ssh/**"]
```
Notes:
@@ -56,4 +69,3 @@ Directories are zipped automatically.
- [Commands & directives](../reference/commands-and-directives.md)
- [Config reference](../reference/config.md)
+52 -18
View File
@@ -11,10 +11,18 @@ takopi init happy-gadgets
This adds a project to your config:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
```
=== "takopi config"
```sh
takopi config set projects.happy-gadgets.path "~/dev/happy-gadgets"
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
```
## Target a project from chat
@@ -28,30 +36,56 @@ Send:
Projects can override global defaults:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
default_engine = "claude"
worktrees_dir = ".worktrees"
worktree_base = "master"
```
=== "takopi config"
```sh
takopi config set projects.happy-gadgets.path "~/dev/happy-gadgets"
takopi config set projects.happy-gadgets.default_engine "claude"
takopi config set projects.happy-gadgets.worktrees_dir ".worktrees"
takopi config set projects.happy-gadgets.worktree_base "master"
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
default_engine = "claude"
worktrees_dir = ".worktrees"
worktree_base = "master"
```
If you expect to edit config while Takopi is running, enable hot reload:
```toml
watch_config = true
```
=== "takopi config"
```sh
takopi config set watch_config true
```
=== "toml"
```toml
watch_config = true
```
## Set a default project
If you mostly work in one repo:
```toml
default_project = "happy-gadgets"
```
=== "takopi config"
```sh
takopi config set default_project "happy-gadgets"
```
=== "toml"
```toml
default_project = "happy-gadgets"
```
## Related
- [Context resolution](../reference/context-resolution.md)
- [Worktrees](worktrees.md)
+14 -6
View File
@@ -12,11 +12,20 @@ takopi chat-id --project happy-gadgets
Then send any message in the target chat. Takopi captures the `chat_id` and updates your config:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
chat_id = -1001234567890
```
=== "takopi config"
```sh
takopi config set projects.happy-gadgets.path "~/dev/happy-gadgets"
takopi config set projects.happy-gadgets.chat_id -1001234567890
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
chat_id = -1001234567890
```
Messages from that chat now default to the project.
@@ -36,4 +45,3 @@ takopi chat-id
- [Topics](topics.md)
- [Context resolution](../reference/context-resolution.md)
+14 -5
View File
@@ -27,11 +27,20 @@ Topics bind Telegram **forum threads** to a project/branch context. Each topic k
## Enable topics
```toml
[transports.telegram.topics]
enabled = true
scope = "auto" # auto | main | projects | all
```
=== "takopi config"
```sh
takopi config set transports.telegram.topics.enabled true
takopi config set transports.telegram.topics.scope "auto"
```
=== "toml"
```toml
[transports.telegram.topics]
enabled = true
scope = "auto" # auto | main | projects | all
```
### Scope explained
+14 -6
View File
@@ -4,11 +4,20 @@ Enable transcription so voice notes become normal text runs.
## Enable transcription
```toml
[transports.telegram]
voice_transcription = true
voice_transcription_model = "gpt-4o-mini-transcribe" # optional
```
=== "takopi config"
```sh
takopi config set transports.telegram.voice_transcription true
takopi config set transports.telegram.voice_transcription_model "gpt-4o-mini-transcribe"
```
=== "toml"
```toml
[transports.telegram]
voice_transcription = true
voice_transcription_model = "gpt-4o-mini-transcribe" # optional
```
Set `OPENAI_API_KEY` in your environment (uses OpenAIs transcription API).
@@ -24,4 +33,3 @@ If transcription fails, youll get an error message and the run is skipped.
## Related
- [Config reference](../reference/config.md)
+16 -7
View File
@@ -6,12 +6,22 @@ Use `@branch` to run tasks in a dedicated git worktree for that branch.
Add a `worktrees_dir` (and optionally a base branch) to the project:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
worktrees_dir = ".worktrees" # relative to project path
worktree_base = "master" # base branch for new worktrees
```
=== "takopi config"
```sh
takopi config set projects.happy-gadgets.path "~/dev/happy-gadgets"
takopi config set projects.happy-gadgets.worktrees_dir ".worktrees"
takopi config set projects.happy-gadgets.worktree_base "master"
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
worktrees_dir = ".worktrees" # relative to project path
worktree_base = "master" # base branch for new worktrees
```
## Run in a branch worktree
@@ -39,4 +49,3 @@ When you reply, this context carries forward (you usually dont need to repeat
## Related
- [Context resolution](../reference/context-resolution.md)
+36 -12
View File
@@ -52,10 +52,18 @@ BACKEND = EngineBackend(
Engine config is a raw table in `takopi.toml`:
```toml
[myengine]
model = "..."
```
=== "takopi config"
```sh
takopi config set myengine.model "..."
```
=== "toml"
```toml
[myengine]
model = "..."
```
## Transport backend plugin
@@ -92,19 +100,35 @@ BACKEND = MyCommand()
Configure under `[plugins.<id>]`:
```toml
[plugins.hello]
greeting = "hello"
```
=== "takopi config"
```sh
takopi config set plugins.hello.greeting "hello"
```
=== "toml"
```toml
[plugins.hello]
greeting = "hello"
```
The parsed dict is available as `ctx.plugin_config` in `handle()`.
## Enable/disable installed plugins
```toml
[plugins]
enabled = ["takopi-transport-slack", "takopi-engine-acme"]
```
=== "takopi config"
```sh
takopi config set plugins.enabled '["takopi-transport-slack", "takopi-engine-acme"]'
```
=== "toml"
```toml
[plugins]
enabled = ["takopi-transport-slack", "takopi-engine-acme"]
```
- `enabled = []` (default) means “load all installed plugins”.
- If non-empty, only distributions with matching names are visible.