chore: align startup pwd with codex working dir
This commit is contained in:
@@ -21,10 +21,6 @@ chat_id = 123456789
|
|||||||
|
|
||||||
`chat_id` is used both for allowed messages and startup notifications.
|
`chat_id` is used both for allowed messages and startup notifications.
|
||||||
|
|
||||||
Optional keys:
|
|
||||||
|
|
||||||
- exec/resume: `cd`, `codex_exec_args`
|
|
||||||
|
|
||||||
## Option 1: exec/resume
|
## Option 1: exec/resume
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
|
|||||||
@@ -323,14 +323,20 @@ def _parse_bridge_config(
|
|||||||
token = config["bot_token"]
|
token = config["bot_token"]
|
||||||
chat_id = int(config["chat_id"])
|
chat_id = int(config["chat_id"])
|
||||||
|
|
||||||
startup_pwd = os.getcwd()
|
|
||||||
startup_msg = f"codex exec bridge has started\npwd: {startup_pwd}"
|
|
||||||
|
|
||||||
codex_cmd = shutil.which("codex")
|
codex_cmd = shutil.which("codex")
|
||||||
if not codex_cmd:
|
if not codex_cmd:
|
||||||
raise RuntimeError("codex not found on PATH")
|
raise RuntimeError("codex not found on PATH")
|
||||||
|
|
||||||
workspace = cd if cd is not None else config.get("cd")
|
startup_pwd = os.getcwd()
|
||||||
|
workspace = None
|
||||||
|
if cd is not None:
|
||||||
|
expanded_cd = os.path.expanduser(cd)
|
||||||
|
if not os.path.isdir(expanded_cd):
|
||||||
|
raise RuntimeError(f"--cd must be an existing directory: {expanded_cd}")
|
||||||
|
workspace = expanded_cd
|
||||||
|
startup_pwd = expanded_cd
|
||||||
|
|
||||||
|
startup_msg = f"codex exec bridge has started\npwd: {startup_pwd}"
|
||||||
raw_exec_args = config.get("codex_exec_args", "")
|
raw_exec_args = config.get("codex_exec_args", "")
|
||||||
if isinstance(raw_exec_args, list):
|
if isinstance(raw_exec_args, list):
|
||||||
extra_args = [str(v) for v in raw_exec_args]
|
extra_args = [str(v) for v in raw_exec_args]
|
||||||
@@ -651,7 +657,7 @@ def run(
|
|||||||
cd: str | None = typer.Option(
|
cd: str | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
"--cd",
|
"--cd",
|
||||||
help="Pass through to `codex --cd` (defaults to `cd` in ~/.codex/telegram.toml).",
|
help="Pass through to `codex --cd`.",
|
||||||
),
|
),
|
||||||
model: str | None = typer.Option(
|
model: str | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
|
|||||||
Reference in New Issue
Block a user