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
+26 -9
View File
@@ -57,11 +57,20 @@ To continue the same session, **reply** to a message with a resume line:
You can manually change these settings in your config file:
```toml
[transports.telegram]
session_mode = "chat" # "chat" or "stateless"
show_resume_line = false # true or false
```
=== "takopi config"
```sh
takopi config set transports.telegram.session_mode "chat"
takopi config set transports.telegram.show_resume_line false
```
=== "toml"
```toml
[transports.telegram]
session_mode = "chat" # "chat" or "stateless"
show_resume_line = false # true or false
```
Or re-run onboarding to pick a different workflow:
@@ -76,10 +85,18 @@ Resume lines are still shown when no project context is set, so replies can bran
If you prefer always-visible resume lines, set:
```toml
[transports.telegram]
show_resume_line = true
```
=== "takopi config"
```sh
takopi config set transports.telegram.show_resume_line true
```
=== "toml"
```toml
[transports.telegram]
show_resume_line = true
```
## Reply-to-continue still works
+81 -36
View File
@@ -268,54 +268,99 @@ Your config file lives at `~/.takopi/takopi.toml`. The exact contents depend on
=== "assistant"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
=== "takopi config"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "chat" # auto-resume
show_resume_line = false # cleaner chat
```sh
takopi config set default_engine "codex"
takopi config set transport "telegram"
takopi config set transports.telegram.bot_token "..."
takopi config set transports.telegram.chat_id 123456789
takopi config set transports.telegram.session_mode "chat"
takopi config set transports.telegram.show_resume_line false
takopi config set transports.telegram.topics.enabled false
takopi config set transports.telegram.topics.scope "auto"
```
[transports.telegram.topics]
enabled = false
scope = "auto"
```
=== "toml"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "chat" # auto-resume
show_resume_line = false # cleaner chat
[transports.telegram.topics]
enabled = false
scope = "auto"
```
=== "workspace"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
=== "takopi config"
[transports.telegram]
bot_token = "..."
chat_id = -1001234567890 # forum group
session_mode = "chat"
show_resume_line = false
```sh
takopi config set default_engine "codex"
takopi config set transport "telegram"
takopi config set transports.telegram.bot_token "..."
takopi config set transports.telegram.chat_id -1001234567890
takopi config set transports.telegram.session_mode "chat"
takopi config set transports.telegram.show_resume_line false
takopi config set transports.telegram.topics.enabled true
takopi config set transports.telegram.topics.scope "auto"
```
[transports.telegram.topics]
enabled = true # topics on
scope = "auto"
```
=== "toml"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = -1001234567890 # forum group
session_mode = "chat"
show_resume_line = false
[transports.telegram.topics]
enabled = true # topics on
scope = "auto"
```
=== "handoff"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
=== "takopi config"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "stateless" # reply-to-continue
show_resume_line = true # always show resume lines
```sh
takopi config set default_engine "codex"
takopi config set transport "telegram"
takopi config set transports.telegram.bot_token "..."
takopi config set transports.telegram.chat_id 123456789
takopi config set transports.telegram.session_mode "stateless"
takopi config set transports.telegram.show_resume_line true
takopi config set transports.telegram.topics.enabled false
takopi config set transports.telegram.topics.scope "auto"
```
[transports.telegram.topics]
enabled = false
scope = "auto"
```
=== "toml"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "stateless" # reply-to-continue
show_resume_line = true # always show resume lines
[transports.telegram.topics]
enabled = false
scope = "auto"
```
This config file controls all of Takopi's behavior. You can edit it directly to change settings or add advanced features.
+35 -13
View File
@@ -109,11 +109,20 @@ Each topic remembers its own default.
Set a default engine in your project config:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
default_engine = "claude"
```
=== "takopi config"
```sh
takopi config set projects.happy-gadgets.path "~/dev/happy-gadgets"
takopi config set projects.happy-gadgets.default_engine "claude"
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
default_engine = "claude"
```
Now `/happy-gadgets` tasks default to Claude, even if your global default is Codex.
@@ -144,15 +153,28 @@ This means: resume lines always win, then explicit directives, then the most spe
**Pattern: Quick questions vs. deep work**
```
# Global default for quick stuff
default_engine = "codex"
=== "takopi config"
# Project default for complex codebase
[projects.backend]
path = "~/dev/backend"
default_engine = "claude"
```
```sh
# Global default for quick stuff
takopi config set default_engine "codex"
# Project default for complex codebase
takopi config set projects.backend.path "~/dev/backend"
takopi config set projects.backend.default_engine "claude"
```
=== "toml"
```toml
# Global default for quick stuff
default_engine = "codex"
# Project default for complex codebase
[projects.backend]
path = "~/dev/backend"
default_engine = "claude"
```
Simple messages go to Codex. `/backend` messages go to Claude.
+39 -13
View File
@@ -31,10 +31,18 @@ saved project 'happy-gadgets' to ~/.takopi/takopi.toml
This adds an entry to your config (Takopi also fills in defaults like `worktrees_dir`, `default_engine`, and sometimes `worktree_base`):
```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"
```
!!! tip "Project aliases are also Telegram commands"
The alias becomes a `/command` you can use in chat. Keep them short and lowercase: `myapp`, `backend`, `docs`.
@@ -69,12 +77,22 @@ Worktrees let you run tasks on feature branches without touching your main check
Add worktree config to your project:
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
worktrees_dir = ".worktrees" # where branches go
worktree_base = "main" # base for new branches
```
=== "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 "main"
```
=== "toml"
```toml
[projects.happy-gadgets]
path = "~/dev/happy-gadgets"
worktrees_dir = ".worktrees" # where branches go
worktree_base = "main" # base for new branches
```
!!! note "Ignore the worktrees directory"
Add `.worktrees/` to your global gitignore so it doesn't clutter `git status`:
@@ -125,9 +143,17 @@ The `ctx:` line in each message carries the context forward.
If you mostly work in one repo, set it as the default:
```toml
default_project = "happy-gadgets"
```
=== "takopi config"
```sh
takopi config set default_project "happy-gadgets"
```
=== "toml"
```toml
default_project = "happy-gadgets"
```
Now messages without a `/project` prefix go to that repo: