fix: correct local config path
This commit is contained in:
@@ -32,7 +32,7 @@ uv run takopi --help
|
||||
|
||||
### Configuration
|
||||
|
||||
Create `~/.codex/takopi.toml` (or `./codex/takopi.toml` for a repo-local config):
|
||||
Create `~/.codex/takopi.toml` (or `./.codex/takopi.toml` for a repo-local config):
|
||||
|
||||
```toml
|
||||
bot_token = "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
|
||||
@@ -46,7 +46,7 @@ chat_id = 123456789
|
||||
|
||||
The bridge only accepts messages where the chat ID equals the sender ID and both match `chat_id` (i.e., private chat with that user).
|
||||
|
||||
When you pass `--cd`, Takopi looks for `codex/takopi.toml` under that directory first.
|
||||
When you pass `--cd`, Takopi looks for `.codex/takopi.toml` under that directory first.
|
||||
|
||||
### Codex Profile (Optional)
|
||||
|
||||
|
||||
+19
-2
@@ -10,6 +10,12 @@ class ConfigError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
_EXAMPLE_CONFIG = (
|
||||
'bot_token = "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"\n'
|
||||
"chat_id = 123456789\n"
|
||||
)
|
||||
|
||||
|
||||
def _display_path(path: Path) -> str:
|
||||
try:
|
||||
cwd = Path.cwd()
|
||||
@@ -24,9 +30,20 @@ def _display_path(path: Path) -> str:
|
||||
|
||||
|
||||
def _missing_config_message(primary: Path, alternate: Path | None = None) -> str:
|
||||
example = "Example config:\n```\n" + _EXAMPLE_CONFIG + "```\n"
|
||||
if alternate is None:
|
||||
return f"Missing config file `{_display_path(primary)}`."
|
||||
return "Missing takopi config. See readme.md for setup."
|
||||
return (
|
||||
f"Missing config file `{_display_path(primary)}`.\n"
|
||||
f"{example}"
|
||||
)
|
||||
return (
|
||||
"Missing takopi config.\n"
|
||||
"Create one of these files:\n"
|
||||
f" {_display_path(alternate)}\n"
|
||||
f" {_display_path(primary)}\n"
|
||||
"\n"
|
||||
f"{example}"
|
||||
)
|
||||
|
||||
|
||||
def _config_candidates(base_dir: Path | None) -> list[Path]:
|
||||
|
||||
@@ -3,5 +3,5 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
|
||||
TELEGRAM_HARD_LIMIT = 4096
|
||||
LOCAL_CONFIG_NAME = Path("codex") / "takopi.toml"
|
||||
LOCAL_CONFIG_NAME = Path(".codex") / "takopi.toml"
|
||||
HOME_CONFIG_PATH = Path.home() / ".codex" / "takopi.toml"
|
||||
|
||||
Reference in New Issue
Block a user